shirakaba / react-nativescript

React renderer for NativeScript
https://react-nativescript.netlify.com
MIT License
280 stars 14 forks source link

How to access the native apis? #75

Closed Lelelo1 closed 3 years ago

Lelelo1 commented 3 years ago

How to access the native apis?

Lelelo1 commented 3 years ago

To setup native access (interacting with native elements or apis in ts) - it's needed to:

npm install @nativescript/types --save-dev

and then add reference.d.ts in the root folder:

Screenshot 2021-01-29 at 13 51 43

...like given in the NativeScript docs: https://docs.nativescript.org/core-concepts/accessing-native-apis-with-javascript

Lelelo1 commented 3 years ago

Then the ios namespaces can then be accessed and device id gotten by:

Screenshot 2021-01-29 at 15 20 12


And android namespaces like:

Screenshot 2021-01-29 at 15 23 01