react-native
react-native copied to clipboard
[Android] FabricViewStateManager: setState called without a StateWrapper
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
i have no idea what is wrong , but i app get stuck and logcat print FabricViewStateManager: setState called without a StateWrapper
repeatedly
React Native version:
Run react-native info
in your terminal and copy the results here.
System:
OS: macOS 11.5.2
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 2.38 GB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 12.19.0 - /usr/local/bin/node
Yarn: 1.22.5 - ~/.yarn/bin/yarn
npm: 7.19.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 21, 23, 25, 26, 27, 28, 29, 30
Build Tools: 23.0.1, 26.0.1, 26.0.2, 27.0.3, 28.0.3, 29.0.2
System Images: android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7621141
Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_212 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^17.0.2 => 17.0.2
react-native: ^0.64.1 => 0.64.1
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
Expected Results
Describe what you expected to happen.
Snack, code example, screenshot, or link to a repository:
Please provide a Snack (https://snack.expo.io/), a link to a repository on GitHub, or provide a minimal code example that reproduces the problem. You may provide a screenshot of the application if you think it is relevant to your bug report. Here are some tips for providing a minimal example: https://stackoverflow.com/help/mcve
same here on 0.65, error is incredibly crypted, google returns really few results.
Yeah, I had this problem too. I downgraded to 0.64.2 and it stopped crashing. :) Don't know what's wrong with the 65 though, I liked it a lot until it started crashing.
@gigadeplex it's not only on 0.65.x, it happened to me on 0.64.x too, it would be great if someone from facebook team explain why this is throwing. In my case it won't crash the app
same here
The same thing just happened to me, after installing react navigation drawer and reanimated 2, now the app crashes and the screen goes blank, help me
facing the same issue can someone help please
I solved it by migrating my logic to a new project of react native 0.65.1 with the latest versions of react navigation
same issue
same here
same here
My app uses RN 0.65.1 with react-native-reanimated v2.2.2 and it was facing this issue on android. I updated react-native-reanimated to v2.3.0-beta.2 and in my initial testing I cannot replicate this issue now.
+1 same issue, any solutions except upgrading to 2.3.x ?
I was also facing this issue, I was using @react-navigation/stack. I simply moved to @react-navigation/native-stack and the issue is resolved for me. may help.
"@react-navigation/drawer": "^6.1.8", "@react-navigation/native": "^6.0.6", "@react-navigation/native-stack": "^6.2.5", "react-native-reanimated": "^2.2.0", "react": "17.0.1", "react-native": "0.64.2",
happy coding. all the best.
same here!
same problem
Just import the hooks from the navigation/native not from the core. Like useRoute, useNavigation, usScrollToTop
Just import the hooks from the navigation/native not from the core. Like useRoute, useNavigation, usScrollToTop
Which hooks? All my used useState Hooks?
same problem
I got the same both on Android and iOS, the "solution" I had was to call console.log
close to where the error was raised, somehow that works 🤔
For me this error shows up when I import a TextInput component. I'm on RN version 0.67.0 and it maches the screen shot in this issue https://github.com/facebook/react-native/issues/32114
Ok, my issue wasn't the same as this one please view https://github.com/facebook/react-native/issues/31572 for a workaround
it seem that it happened when ReactScrollView updateStateOnScroll
"react-native": "0.66.4"
The error message will show when scrolling Flatlist.
This same error to showed my logcat. But I worked on Curved navigation bar, after routing not worked and crashed and showed this error..
any progress in this issue?
I'm also experiencing the same issue, after debugging, here's the flow that originates the issue:
-
NativeViewHierarchyManager
gets called on the methodcreateView()
which passes the stateWrapper asnull
- The call from 1) calls
createView()
fromViewManager
(with a null stateWrapper). - The call from 2) calls
onCreateViewInstance
which has the following logic:
if (stateWrapper != null) {
Object extraData = updateState(view, initialProps, stateWrapper);
if (extraData != null) {
updateExtraData(view, extraData);
}
}
Because the stateWrapper
is null, the ViewManager
's updateState()
won't be called.
- On
ReactSrollView
OnLayout()
function callsreactScrollTo()
-
reactScrollTo()
function callsupdateStateOnScroll()
which has the following logic:
mFabricViewStateManager.setState(
new FabricViewStateManager.StateUpdateCallback() {
@Override
public WritableMap getStateUpdate() {
WritableMap map = new WritableNativeMap();
map.putDouble(CONTENT_OFFSET_LEFT, PixelUtil.toDIPFromPixel(scrollX));
map.putDouble(CONTENT_OFFSET_TOP, PixelUtil.toDIPFromPixel(scrollY));
return map;
}
});
- The
setState()
function has the following logic:
if (stateWrapper == null) {
FLog.e(TAG, "setState called without a StateWrapper");
return;
}
This is the flow that I've seen in a project I'm working on. I have the following questions:
- Should the initial
createView()
must setstateWrapper
to null at first? - If the answer to the first question is yes, at what stage does the
stateWrapper
gets updated?
Any update on this issue? I can run my app of the Expo platform without any issues, however when I am running it on the emulator it starts throwing this error and app stops working properly. Stuck for a few days, please help.
any updates on this issue?
Any Update on This Issue, It Still Occurs from Me Also