Good day! We are trying to add your library to a project on the recently released RN 0.80.0 and we get a crash.
Current behaviour
When I add a component from the library to the layout I get a crash.. I think this is happening simply because I updated to RN 0.80.0. But to be honest, I am connecting your library for the first time just along with the update, and I have no way to check whether it worked on lower versions of RN.
Expected behaviour
The application should not crash.
How to reproduce?
Simply add the following code to any render (return) method of your component:
<ReactNativeScannerView
onQrScanned={() => {}}
style={{ flex: 1 }}
isActive={false}
pauseAfterCapture
showBox
/>
Preview
I get this error in xCode and my app freeze (or crash in release build):
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RCTView setIsActive:]: unrecognized selector sent to instance 0x1217f63f0'
*** First throw call stack:
(0x191da0f20 0x189c4f2b8 0x191eaa480 0x194e7d9ac 0x191d3dfb4 0x191d3d8d0 0x10829c884 0x10829d2f0 0x10829dac0 0x108306cbc 0x108306e68 0x10829d950 0x10829de68 0x191d41e54 0x191d41c98 0x10829dd38 0x10829db24 0x108603600 0x107d5dba0 0x107d5becc 0x107d5bc7c 0x107d5b38c 0x107d76f74 0x107d76aac 0x107d76a50 0x107d769f8 0x107d769c4 0x107d7584c 0x10865bfe4 0x10865b264 0x10865b098 0x107d6f52c 0x107d6f1fc 0x107d6eb6c 0x108381a58 0x103244b98 0x1032467bc 0x103256d58 0x10325690c 0x191d73710 0x191d70914 0x191d6fcd8 0x1d67bd1a8 0x1943a9ae8 0x19445dd98 0x1945d7504 0x10790933c 0x1079092ac 0x107909c50 0x1b5547154)
libc++abi: terminating due to uncaught exception of type NSException
And a more detailed transcript comes to firebase:
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x83f20 __exceptionPreprocess
1 libobjc.A.dylib 0x172b8 objc_exception_throw
2 CoreFoundation 0x18d480 +[NSObject(NSObject) _copyDescription]
3 UIKitCore 0xede9ac -[UIResponder doesNotRecognizeSelector:]
4 CoreFoundation 0x20fb4 ___forwarding___
5 CoreFoundation 0x208d0 _CF_forwarding_prep_0
6 my_app_name.debug.dylib 0x998884 __49-[RCTComponentData createPropBlock:isShadowView:]_block_invoke_14 + 321 (RCTComponentData.mm:321)
7 my_app_name.debug.dylib 0x9992f0 __49-[RCTComponentData createPropBlock:isShadowView:]_block_invoke_2.41 + 341 (RCTComponentData.mm:341)
8 my_app_name.debug.dylib 0x999ac0 __49-[RCTComponentData propBlockForKey:isShadowView:]_block_invoke_2 + 363 (RCTComponentData.mm:363)
9 my_app_name.debug.dylib 0xa02cbc RCTPerformBlockWithLogFunction + 167 (RCTLog.mm:167)
10 my_app_name.debug.dylib 0xa02e68 RCTPerformBlockWithLogPrefix + 175 (RCTLog.mm:175)
11 my_app_name.debug.dylib 0x999950 __49-[RCTComponentData propBlockForKey:isShadowView:]_block_invoke + 360 (RCTComponentData.mm:360)
12 my_app_name.debug.dylib 0x999e68 __50-[RCTComponentData setProps:forView:isShadowView:]_block_invoke + 389 (RCTComponentData.mm:389)
13 CoreFoundation 0x24e54 __NSDICTIONARY_IS_CALLING_OUT_TO_A_BLOCK__
14 CoreFoundation 0x24c98 -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:]
15 my_app_name.debug.dylib 0x999d38 -[RCTComponentData setProps:forView:isShadowView:] + 388 (RCTComponentData.mm:388)
16 my_app_name.debug.dylib 0x999b24 -[RCTComponentData setProps:forView:] + 374 (RCTComponentData.mm:374)
17 my_app_name.debug.dylib 0xcff600 -[RCTLegacyViewManagerInteropCoordinator setProps:forView:] + 100 (RCTLegacyViewManagerInteropCoordinator.mm:100)
18 my_app_name.debug.dylib 0x459ba0 -[RCTLegacyViewManagerInteropCoordinatorAdapter setProps:] + 54 (RCTLegacyViewManagerInteropCoordinatorAdapter.mm:54)
19 my_app_name.debug.dylib 0x457ecc -[RCTLegacyViewManagerInteropComponentView _setPropsWithUpdateMask:] + 275 (RCTLegacyViewManagerInteropComponentView.mm:275)
20 my_app_name.debug.dylib 0x457c7c __60-[RCTLegacyViewManagerInteropComponentView finalizeUpdates:]_block_invoke + 221 (RCTLegacyViewManagerInteropComponentView.mm:221)
21 my_app_name.debug.dylib 0x45738c -[RCTLegacyViewManagerInteropComponentView finalizeUpdates:] + 240 (RCTLegacyViewManagerInteropComponentView.mm:240)
22 my_app_name.debug.dylib 0x472f74 RCTPerformMountInstructions(std::__1::vector<facebook::react::ShadowViewMutation, std::__1::allocator<facebook::react::ShadowViewMutation>> const&, RCTComponentViewRegistry*, RCTMountingTransactionObserverCoordinator&, int) + 87 (RCTMountingManager.mm:87)
23 my_app_name.debug.dylib 0x472aac -[RCTMountingManager performTransaction:]::$_1::operator()(facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) const + 266 (RCTMountingManager.mm:266)
24 my_app_name.debug.dylib 0x472a50 decltype(std::declval<-[RCTMountingManager performTransaction:]::$_1&>()(std::declval<facebook::react::MountingTransaction const&>(), std::declval<facebook::react::SurfaceTelemetry const&>())) std::__1::__invoke[abi:de190102]<-[RCTMountingManager performTransaction:]::$_1&, facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&>(-[RCTMountingManager performTransaction:]::$_1&, facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) + 149 (invoke.h:149)
25 my_app_name.debug.dylib 0x4729f8 void std::__1::__invoke_void_return_wrapper<void, true>::__call[abi:de190102]<-[RCTMountingManager performTransaction:]::$_1&, facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&>(-[RCTMountingManager performTransaction:]::$_1&, facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) + 225 (invoke.h:225)
26 my_app_name.debug.dylib 0x4729c4 std::__1::__function::__alloc_func<-[RCTMountingManager performTransaction:]::$_1, std::__1::allocator<-[RCTMountingManager performTransaction:]::$_1>, void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)>::operator()[abi:de190102](facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) + 171 (function.h:171)
27 my_app_name.debug.dylib 0x47184c std::__1::__function::__func<-[RCTMountingManager performTransaction:]::$_1, std::__1::allocator<-[RCTMountingManager performTransaction:]::$_1>, void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)>::operator()(facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) + 313 (function.h:313)
28 my_app_name.debug.dylib 0xd57fe4 std::__1::__function::__value_func<void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)>::operator()[abi:de190102](facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) const + 430 (function.h:430)
29 my_app_name.debug.dylib 0xd57264 std::__1::function<void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)>::operator()(facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&) const + 989 (function.h:989)
30 my_app_name.debug.dylib 0xd57098 facebook::react::TelemetryController::pullTransaction(std::__1::function<void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)> const&, std::__1::function<void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)> const&, std::__1::function<void (facebook::react::MountingTransaction const&, facebook::react::SurfaceTelemetry const&)> const&) const + 39 (TelemetryController.cpp:39)
31 my_app_name.debug.dylib 0x46b52c -[RCTMountingManager performTransaction:] + 258 (RCTMountingManager.mm:258)
32 my_app_name.debug.dylib 0x46b1fc -[RCTMountingManager initiateTransaction:] + 246 (RCTMountingManager.mm:246)
33 my_app_name.debug.dylib 0x46ab6c __42-[RCTMountingManager scheduleTransaction:]_block_invoke + 200 (RCTMountingManager.mm:200)
34 my_app_name.debug.dylib 0xa7da58 __RCTExecuteOnMainQueue_block_invoke + 294 (RCTUtils.mm:294)
35 libdispatch.dylib 0x213c _dispatch_call_block_and_release
36 libdispatch.dylib 0x3dd4 _dispatch_client_callout
37 libdispatch.dylib 0x125a4 _dispatch_main_queue_drain
38 libdispatch.dylib 0x121b8 _dispatch_main_queue_callback_4CF
39 CoreFoundation 0x56710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
40 CoreFoundation 0x53914 __CFRunLoopRun
41 CoreFoundation 0x52cd8 CFRunLoopRunSpecific
42 GraphicsServices 0x11a8 GSEventRunModal
43 UIKitCore 0x40aae8 -[UIApplication _run]
44 UIKitCore 0x4bed98 UIApplicationMain
45 UIKitCore 0x638504 keypath_get_selector_hoverStyle
46 my_app_name.debug.dylib 0x533c static UIApplicationDelegate.main() (<compiler-generated>)
47 my_app_name.debug.dylib 0x52ac static AppDelegate.$main() (<compiler-generated>)
48 my_app_name.debug.dylib 0x5c50 main (<compiler-generated>)
49 my_app_name.debug.dylib 0x5c50 __debug_main_executable_dylib_entry_point + 10 (AppDelegate.swift:10)
50 ??? 0x1b5547154 (Missing)
What have you tried so far?
I tried to fix the setIsActive method using AI, but without success. I also tried to apply the changes from another issue here, but it did not help.
Your Environment
| software |
version |
| ios |
18.5 |
| android |
- |
| react-native |
0.80.0 |
| @pushpendersingh/react-native-scanner |
1.5.0 |
| node |
23.11.0 |
| npm or yarn |
yarn 4.4.0 |
Good day! We are trying to add your library to a project on the recently released RN 0.80.0 and we get a crash.
Current behaviour
When I add a component from the library to the layout I get a crash.. I think this is happening simply because I updated to RN 0.80.0. But to be honest, I am connecting your library for the first time just along with the update, and I have no way to check whether it worked on lower versions of RN.
Expected behaviour
The application should not crash.
How to reproduce?
Simply add the following code to any render (return) method of your component:
Preview
I get this error in xCode and my app freeze (or crash in release build):
And a more detailed transcript comes to firebase:
What have you tried so far?
I tried to fix the setIsActive method using AI, but without success. I also tried to apply the changes from another issue here, but it did not help.
Your Environment