Native libraries in react-native

is there a way to import / include / require native java android or native objective-c / swift in react native apps?

I mean lets say android's libraries like android volley or android libPhoneNumber?

Only if there is react-native Module wrapper for each of those libraries implemented you can use those from the java script side. See more on how to implement Native Modules at https://facebook.github.io/react-native/docs/native-modules-android.html#content https://facebook.github.io/react-native/docs/native-modules-ios.html#content

Yes, there are two ways:

  1. If the libraries/modules were already wrapped and exposed be React-Native, then just use it (learn how to do it in the link below).

  2. If the libraries/modules were NOT wrapped and exposed, then it has to be wrapped and exposed manually first.

Android's Toast library as an example:

  • Used as already wrapped and exposed library/module: https://facebook.github.io/react-native/docs/toastandroid.html#content

  • Used after manual wrapping and exposing: https://facebook.github.io/react-native/docs/native-modules-android.html#content

Comments

Popular posts from this blog

Meaning of `{}` for return expression

Get current scroll position of ScrollView in React Native

flutter websocket connection issue