Placeholder
The Placeholder allows you to add any native widget to your application. To do that, you need to put a Placeholder somewhere in the UI hierarchy and then create and configure the native widget that you want to appear there. Finally, pass your native widget to the event arguments of the creatingView event.
Basics
The example shows, how to create native view and display it via Placeholder
using creatingView event.
Code Behind
The example shows, how to create native view and display it with Placeholder
using creatingView event via code-behind.
Platform Files
The example shows how to define the native widget via Placeholder
, while using platform-specific JavaScript files.
<StackLayout>
<Placeholder creatingView="creatingView"/>
</StackLayout>
.android.js
.ios.js
Note: Using the native API in NativeScript TypeScript project requires adding tns-platform-declarations plugin in the project. The plugin contains type information about the native platforms as exposed by the NativeScript framework.
API Reference for the Placeholder Class