Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

How to make peer dependency conditional in Typescript React Native project

$
0
0

I have created an npm module (Typescript/RN) used for event tracking. One of its features that can be turned on at initialization is to automatically track geolocation data with every event. The module uses the react-native-community/geolocation library to obtain this data, making it a peer dependency. So even if I choose not to track geo data by turning it off at initialization, the geo library is still required as a peer dependency.

Ideally I would want a setup where the library only gets installed whenever we initialize the app to use it. Or maybe we can provide the methods used for obtaining the geolocation as params for the initialization as some sort of plugin. WDYT the best solution would be to this?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>