react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Error: JS Functions are not convertible to dynamic

Open arjun1194 opened this issue 1 year ago • 7 comments

Description

facing a crash for some users with the stack trace

JS Functions are not convertible to dynamic
at ? (null:null:null)
at enqueueNativeCall(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:323:enqueueNativeCall)
at nonPromiseMethodWrapper(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:150:nonPromiseMethodWrapper)
at queueOperation(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Animated/NativeAnimatedHelper.js:84:API.queueOperation)
at addAnimatedEventToView(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Animated/NativeAnimatedHelper.js:195:API.queueOperation$argument_0)
at ? (/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Animated/AnimatedEvent.js:70:eventMappings.forEach$argument_0)
at forEach(null:null:null)
at attachNativeEvent(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Animated/AnimatedEvent.js:68:eventMappings.forEach$argument_0)
at _updateAnimatedNodeAttachment(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js:1119:_updateAnimatedNodeAttachment)
at componentDidUpdate(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Components/ScrollView/ScrollView.js:802:componentDidUpdate)
at commitLayoutEffects(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6060:commitLayoutEffects)
at commitRootImpl(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6864:commitRootImpl)
at commitRoot(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6816:commitRoot)
at performSyncWorkOnRoot(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:6470:performSyncWorkOnRoot)
at performSyncWorkOnRoot(null:null:null)
at flushSyncCallbacks(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:2058:flushSyncCallbacks)
at batchedUpdatesImpl(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:7948:batchedUpdatesImpl)
at batchedUpdates(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1010:batchedUpdates)
at _receiveRootNodeIDEvent(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1041:batchedUpdates$argument_0)
at receiveTouches(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1113:ReactNativePrivateInterface.RCTEventEmitter.register$argument_0.receiveTouches)
at __callFunction(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:419:__callFunction)
at ? (/Users/arjun/anar/mobile/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:116:__guard$argument_0)
at __guard(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:370:__guard)
at callFunctionReturnFlushedQueue(/Users/arjun/anar/mobile/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:115:__guard$argument_0)
at callFunctionReturnFlushedQueue(null:null:null)

as it is clearly visible that the stack is not related to my code. How should i fix this issue ??

Version

0.67.4

Output of npx react-native info

System: OS: macOS 12.2 CPU: (8) arm64 Apple M1 Memory: 102.03 MB / 16.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.17 - /opt/homebrew/bin/yarn npm: 8.5.0 - /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.2 - /usr/local/bin/pod SDKs: iOS SDK: Not Found Android SDK: API Levels: 23, 28, 29, 30, 31 Build Tools: 27.0.3, 28.0.3, 29.0.0, 29.0.3, 30.0.2, 30.0.3, 31.0.0 System Images: android-24 | ARM 64 v8a, android-24 | Google APIs ARM 64 v8a, android-25 | Google APIs ARM 64 v8a, android-27 | ARM 64 v8a, android-30 | ARM 64 v8a, android-30 | Google APIs ARM 64 v8a, android-30 | Google Play ARM 64 v8a, android-31 | ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-31 | Google Play ARM 64 v8a Android NDK: 22.1.7171670 IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8193401 Xcode: /undefined - /usr/bin/xcodebuild Languages: Java: 11.0.13 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: ^18.0.0 => 18.1.0 react-native: 0.67.4 => 0.67.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

use react-native/Libraries/Animated in code

Snack, code example, screenshot, or link to a repository

Error: JS Functions are not convertible to dynamic

This error is located at: in ScrollView in ScrollView in VirtualizedListContextProvider in VirtualizedList in FlatList in Unknown in SelfProfile in Connect(SelfProfile) in Profiler in profiler(Connect(SelfProfile)) in Profile in StaticContainer in EnsureSingleNavigator in SceneView in RCTView in Unknown in MaybeNestedStack in RNSScreen in AnimatedComponent in AnimatedComponentWrapper in Screen in RNSScreenStack in NativeStackView in NativeStackNavigator in StackNavigator in EnsureSingleNavigator in BaseNavigationContainer in ThemeProvider in NavigationContainerInner in AppNavigator in AppInitialization in Profiler in profiler(AppInitialization) in PersistGate in Provider in RCTView in Unknown in SafeAreaView in RCTView in Unknown in RCTView in Unknown in MenuProvider in ApolloProvider in App in ReactNativeProfiler in RCTView in Unknown in __Sentry.TouchEventBoundary in RootApp in RCTView in Unknown in RCTView in Unknown in AppContainer

arjun1194 avatar Jun 15 '22 08:06 arjun1194

Hmm, usually this issue will pop up is when you passed a function as a parameter to a function that was expecting another (e.g. a string).

Can you share the part where enabling Animated in react-native causes the issue?

mnghn07 avatar Jun 20 '22 13:06 mnghn07

Hey, thanks for replying.

but this is not grammatically possible as we have typescript in our project with strict types enabled, so the compiler should have given the error if it was like that.

Since i also dont have the unsymbolicated code pointing to a specific line, can you share some clues as to how i should fix these types of issues ?

arjun1194 avatar Jun 20 '22 13:06 arjun1194

#27203 Hmm, only found this similar issues on the repo itself. and it seems stuck there too. The error message you should be looking for is in node_modules/react-native/ReactCommon/jsi/jsi/JSIDynamic.cpp.

Workaround: You can try using patch-package and patch to this workaround. Though i'll not recommend it.

I got this issue once with the animations also, but it's bc of the wrong type inferred so after few changes, it's working fine.

mnghn07 avatar Jun 20 '22 14:06 mnghn07

I have the same problem. It founded after updating react-native from '0.64.3' to '0.68.2'. I didn't have this error before. Sentry is logging three difference places from functions that worked fine before the update.

I attached stacktraces. Maybe it will help you to investigate the issue.

trace_1.txt trace_2.txt trace_3.txt

pechischev avatar Sep 08 '22 07:09 pechischev

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 21 '23 06:04 github-actions[bot]

still an issue

d4rky-pl avatar Nov 24 '23 13:11 d4rky-pl

Someone may be interested: I had the same error caused by Sentry.addBreadcrumb() with a 'message' that was not a string in some cases.

koloboid avatar Dec 17 '23 21:12 koloboid