Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I created a React-Native application Then I created a React-Native Library using this seed github.com/frostney/react-native-create-library

Now, I need to use this package https://github.com/toystars/react-native-geo-fence Inside of the Library.

Problem is: The library is not a react-native application, and the geo-fence lib needs linking.

I cant change the React-Native App and can not use the geo-fence directly inside of it, of course.

The logic will need to stay inside the Library i created.

When i linked the Library i created (with the geo fence package on it already), with the App i created, the geo-fence gradle settings and android configurations didn't happen at the APP.

  • this concerns Android only
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
195 views
Welcome To Ask or Share your Answers For Others

1 Answer

It is not possible to link a react-native library to another react-native library.

So the correct procedure is to add any third party react-native library, that requires link, that you want to use inside your own react-native library, as peerDependency on package.json.

This way the third party lib will be installed directly at the app, and will be linked, necessarily to the app, but the logic using the third party lib will be inside your own.

So you can create a lib, add react-native-geo-fence as peerDependency of your lib, then code as you wish. After this, the app using your lib, will have to install it and link manually the react-native-geo-fence, then that's it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...