transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.66k stars 426 forks source link

Compatibility with React Native New Architecture #2210

Closed FlavioScimeca closed 2 days ago

FlavioScimeca commented 3 days ago

I currently have a production-ready app using react-native-background-geolocation. I am considering upgrading the project to use React Native’s new architecture, but the documentation does not explicitly confirm whether the library is fully compatible. Before proceeding, I need to ensure there are no compatibility issues or significant steps required for integration.

christocracy commented 2 days ago

I’m not aware of any way that could affect the plug-in. The plug-in operates largely unaffected by React Native. Why don’t you try it and see.

FlavioScimeca commented 2 days ago

I asked because I should update the other dependencies as well , anyway thank you

christocracy commented 2 days ago

The plug-in is definitely not affect by anything related to UI or JavaScript.

this plug-in exists mostly within pure native libraries that don’t even know that RN exists. These libraries are common to all versions of the plug-in (Cordova, Capacitor, Flutter, React Native). These native libs can even work in pure native apps.

there’s not much that RN can do to affect this sdk.

christocracy commented 2 days ago

React Native seems to have an issue with running "Headless" code with new archictecture. Both this plugin and react-native-background-fetch make use of react-native's "HeadlessJS" mechanism. A reproduction example has been provided to the React Native team two days ago.

See https://github.com/facebook/react-native/issues/47592

mikehardy commented 2 days ago

@christocracy react-native can quietly alter the android native module teardown callback from onCatalystInstanceDestroy to invalidate and then leave onCatalystInstanceDestroy in there so that it doesn't cause a build failure but nothing ever calls it - that one bit me in react-native-firebase, fixed it just a couple days back 😆

For react-native 0.76.2 (current as of this typing) I do not see any problems with headlessJS anymore on new architecture (which is now the default in 0.76.0+) - contrary to your statement above. 0.76.2+new-arch should work.

I do see problems now with old architecture on react-native >= 0.76.0 through at least 0.76.2, and I logged an upstream reproducer for that in the issue you linked.