[Bug]: Use CustomLocationProvider kill app on IOS in RN 0.76.3
Mapbox Implementation
Mapbox
Mapbox Version
default
React Native Version
0.76.3
Platform
iOS
@rnmapbox/maps version
10.1.33
Standalone component to reproduce
import React from 'react';
import Mapbox from '@rnmapbox/maps';
Mapbox.setAccessToken('<token>')
const App = () => {
return (
<>
<Mapbox.MapView
styleURL={ Mapbox.StyleURL.SatelliteStreet }
style={ { flex: 1 } }
testID={'show-map'}
>
<Mapbox.Camera followZoomLevel={12} followUserLocation />
<Mapbox.CustomLocationProvider coordinate={ [ -71, -30 ] } heading={ 75 } />
<Mapbox.LocationPuck />
</Mapbox.MapView>
</>
);
}
export default App;
Observed behavior and steps to reproduce
- New app created with command
npx @react-native-community/cli@latest init AwesomeProject - Fresh installation of
@rnmapbox/mapsfollowing the instructions on https://rnmapbox.github.io/docs/install for IOS device - When a try to see the map component, the app throws an error and die. The error is:
Thread 1: "ComponentView with componentHandle105553119214624(RNMBXCustomLocationProvider) not found."
Expected behavior
No error
Notes / preliminary analysis
- If a run the app without
CustomLocationProviderall works - On android the app runs without error
Additional links and references
Running "AwesomeProject" with {"rootTag":1,"initialProps":{"concurrentRoot":true},"fabric":true}
*** Assertion failure in -[RCTComponentViewFactory createComponentViewWithComponentHandle:](), /Users/emoreno/git/trabajo/new-project/AwesomeProject/node_modules/react-native/React/Fabric/Mounting/RCTComponentViewFactory.mm:209
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'ComponentView with componentHandle `105553119214624` (`RNMBXCustomLocationProvider`) not found.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001804b70ec __exceptionPreprocess + 172
1 libobjc.A.dylib 0x000000018008ede8 objc_exception_throw + 72
2 Foundation 0x0000000180e73c40 -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0
3 AwesomeProject.debug.dylib 0x0000000106aceca8 -[RCTComponentViewFactory createComponentViewWithComponentHandle:] + 608
4 AwesomeProject.debug.dylib 0x0000000106ad803c -[RCTComponentViewRegistry _dequeueComponentViewWithComponentHandle:] + 356
5 AwesomeProject.debug.dylib 0x0000000106ad7460 -[RCTComponentViewRegistry dequeueComponentViewWithComponentHandle:tag:] + 624
6 AwesomeProject.debug.dylib 0x0000000106b18ae0 _ZL27RCTPerformMountInstructionsRKNSt3__16vectorIN8facebook5react18ShadowViewMutationENS_9allocatorIS3_EEEEP24RCTComponentViewRegistryR41RCTMountingTransactionObserverCoordinatori + 260
7 AwesomeProject.debug.dylib 0x0000000106b189d0 _ZZ41-[RCTMountingManager performTransaction:]ENK3$_1clERKN8facebook5react19MountingTransactionERKNS1_16SurfaceTelemetryE + 80
8 AwesomeProject.debug.dylib 0x0000000106b18974 _ZNSt3__18__invokeB8de180100IRZ41-[RCTMountingManager performTransaction:]E3$_1JRKN8facebook5react19MountingTransactionERKNS4_16SurfaceTelemetryEEEEDTclclsr3stdE7declvalIT_EEspclsr3stdE7declvalIT 9 AwesomeProject.debug.dylib 0x0000000106b1891c _ZNSt3__128__invoke_void_return_wrapperIvLb1EE6__callB8de180100IJRZ41-[RCTMountingManager performTransaction:]E3$_1RKN8facebook5react19MountingTransactionERKNS6_16SurfaceTelemetryEEEEvDpOT_ + 40
10 AwesomeProject.debug.dylib 0x0000000106b188e8 _ZNSt3__110__function12__alloc_funcIZ41-[RCTMountingManager performTransaction:]E3$_1NS_9allocatorIS2_EEFvRKN8facebook5react19MountingTransactionERKNS6_16SurfaceTelemetryEEEclB8de180100ES9_SC_ + 11 AwesomeProject.debug.dylib 0x0000000106b17764 _ZNSt3__110__function6__funcIZ41-[RCTMountingManager performTransaction:]E3$_1NS_9allocatorIS2_EEFvRKN8facebook5react19MountingTransactionERKNS6_16SurfaceTelemetryEEEclES9_SC_ + 44
12 AwesomeProject.debug.dylib 0x00000001068eb6f0 _ZNKSt3__110__function12__value_funcIFvRKN8facebook5react19MountingTransactionERKNS3_16SurfaceTelemetryEEEclB8de180100ES6_S9_ + 84
13 AwesomeProject.debug.dylib 0x00000001068ea654 _ZNKSt3__18functionIFvRKN8facebook5react19MountingTransactionERKNS2_16SurfaceTelemetryEEEclES5_S8_ + 40
14 AwesomeProject.debug.dylib 0x00000001068ea484 _ZNK8facebook5react19TelemetryController15pullTransactionERKNSt3__18functionIFvRKNS0_19MountingTransactionERKNS0_16SurfaceTelemetryEEEESD_SD_ + 300
15 AwesomeProject.debug.dylib 0x0000000106b12b3c -[RCTMountingManager performTransaction:] + 564
16 AwesomeProject.debug.dylib 0x0000000106b128b8 -[RCTMountingManager initiateTransaction:] + 428
17 AwesomeProject.debug.dylib 0x0000000106b12294 __42-[RCTMountingManager scheduleTransaction:]_block_invoke + 324
18 AwesomeProject.debug.dylib 0x00000001066f03b8 __RCTExecuteOnMainQueue_block_invoke + 40
19 libdispatch.dylib 0x0000000102754ec0 _dispatch_call_block_and_release + 24
20 libdispatch.dylib 0x00000001027567b8 _dispatch_client_callout + 16
21 libdispatch.dylib 0x000000010276645c _dispatch_main_queue_drain + 1224
22 libdispatch.dylib 0x0000000102765f84 _dispatch_main_queue_callback_4CF + 40
23 CoreFoundation 0x000000018041ae3c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
24 CoreFoundation 0x0000000180415534 __CFRunLoopRun + 1944
25 CoreFoundation 0x0000000180414960 CFRunLoopRunSpecific + 536
26 GraphicsServices 0x0000000190183b10 GSEventRunModal + 160
27 UIKitCore 0x0000000185aa2b40 -[UIApplication _run] + 796
28 UIKitCore 0x0000000185aa6d38 UIApplicationMain + 124
29 AwesomeProject.debug.dylib 0x000000010658ad88 __debug_main_executable_dylib_entry_point + 96
30 dyld 0x0000000102689410 start_sim + 20
31 ??? 0x000000010285a274 0x0 + 4337279604
)
libc++abi: terminating due to uncaught exception of type NSException
the same with react native 0.76.5
"@rnmapbox/maps": "^10.1.31", "react-native": "0.76.6",
I have the same problem with the CustomLocationProvider on IOS.
@emoreno-94 did you find solution for this issue?
No, I’m temporarily not using a custom location on iOS
@mfazekas Could you please help with this? I'm not sure where to digging.
the same with:
react-native: 0.76.6
@rnmapbox/maps: 10.1.35
I'm experiencing the same issue with React Native 0.79 and @rnmapbox/maps 10.1.38
I was able to bypass this by updating the Podfile with:
ENV['RCT_NEW_ARCH_ENABLED'] = '0'`
(I added this to very top)
this will tell the app to explicitly disable the New Architecture and fall back to the legacy Bridge architecture
Below patch file resolves the ios crash with @rnmapbox/maps 10.1.39 and React Native 0.79.5
iOS: RNMBXCustomLocationProvider.swift / RNMBXCustomLocationProviderComponentView.mm - replace RNMBXCircleLayerProps with RNMBXCustomLocationProviderProps Android: RNMBXCustomLocationProvider.kt - on android and ios immediately send a coordinate when the consumer registers for updates, don't wait for the next update.
*My first time contributing, use at your own risk!