I want to be able to export a package for all platforms, but I am using some native bindings with a plain JS fallback. Normally I would notice the difference
checking if object window
or exports
exist.
How can I achieve this on React Native?
So when you write your components, you can check if React. View exists. If it does, you're using React Native. Otherwise, you're using the web version.
Go to res->layout and search for com_facebook... , In my case it was com_facebook_activity_layout. xml . If you have one layout with com_facebook in it then this apk was created with React.
Here is how to check if code is on web, nodejs, or react-native:
if (typeof document !== 'undefined') {
// I'm on the web!
}
else if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
// I'm in react-native
}
else {
// I'm in node js
}
Sources:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With