Vanilla JavaScript
The quick-start example uses the plain javascript React.createElement / preact.h syntax.
The following is a list of accepted component names, sorted just like the NativeScript cookbook navigation and also linkng there.
- Layouts
- actionBar / actionItem / navigationButton
- activityIndicator
- button
- datePicker
- htmlView
- image
- label
- listPicker
- listView
- page
- placeholder
- progress
- scrollView
- searchBar
- segmentedBar
- slider
- switch
- tabView / tabViewItem
- textField
- textView
- timePicker
- webView
JSX
If you prefer JSX check out preact-nativescript-components which makes the code look like so:
var application = require("application")
import { render } from "preact-to-nativescript"
import { Page, ActionBar, StackLayout, Label } from "preact-nativescript-components"
application.start({
create: () => {
return render(
<Page>
<ActionBar title="Custom Title" />
<StackLayout>
<Label text="preact-to-nativescript page">
</StackLayout>
</Page>
)
}
})