feat: supporting apps that have enabled New Architecture #481
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is intended to start a discussion about how we could support apps that have enabled React Native's New Architecture (without upgrading
maplibre-react-native
itself to the New Architecture just yet, which is significantly more work). It includes some quick changes to demonstrate the quirks I found and to render a basicMapView
example - definitely not a complete solution! 😄I was able to render a simple
MapView
without any additional changes oniOS
(the 'Interop Layer' does all of the work and was updated as of RN 0.74 to be enabled by default). The docs say that "it will work with every component that has not migrated yet" (reactwg/react-native-new-architecture#175), but it does not work in all cases unfortunately, and getting aMapView
to render onAndroid
required additional changes:MapLibreGL
module and it's methods could not be accessed in the regular way, I had to use the underlyingRCTMLNModule
(not an ideal solution but it works for the purposes of this demo)UIManagerModule
- this discussion about the use ofUIManager
in the New Architecture explains that "UIManagerModule
is deprecated in favour ofUIManager
in the New Architecture.".UIManagerModule
is currently used onAndroid
in theAbstractedEventEmitter
component - replacing it with the newUIManager
(viaUIManagerHelper
) was required to render aMapView
To see the example, run the
expo-app
and from the home screen navigate to Map > Show Map.Feedback and suggestions for next steps are very welcome!
Checklist
yarn lint:eslint:fix
in the root folderyarn test
in the root folderyarn generate
in the root folderCHANGELOG.md
/packages/examples
)