Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] FabricViewStateManager: setState called without a StateWrapper #32070

Closed
KingAmo opened this issue Aug 23, 2021 · 44 comments
Closed

[Android] FabricViewStateManager: setState called without a StateWrapper #32070

KingAmo opened this issue Aug 23, 2021 · 44 comments
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@KingAmo
Copy link

KingAmo commented Aug 23, 2021

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

@KingAmo
Copy link
Author

KingAmo commented Aug 23, 2021

image

@efstathiosntonas
Copy link

same here on 0.65, error is incredibly crypted, google returns really few results.

@gigadeplex
Copy link

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.

@efstathiosntonas
Copy link

efstathiosntonas commented Aug 25, 2021

@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

@cloudychen
Copy link

same here

@Dsantacruz
Copy link

Dsantacruz commented Sep 10, 2021

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

@aliraza-noon
Copy link

facing the same issue can someone help please

@Dsantacruz
Copy link

I solved it by migrating my logic to a new project of react native 0.65.1 with the latest versions of react navigation

@Daha62
Copy link

Daha62 commented Sep 22, 2021

same issue

@kuenyu40
Copy link

same here

1 similar comment
@Levin-nik
Copy link

same here

@adhip94
Copy link

adhip94 commented Oct 11, 2021

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.

@Bayramito
Copy link

+1 same issue, any solutions except upgrading to 2.3.x ?

@aashu700
Copy link

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.

@maaliHasan
Copy link

same here!

@mwegener-com
Copy link

same problem

@Bayramito
Copy link

Just import the hooks from the navigation/native not from the core. Like useRoute, useNavigation, usScrollToTop

@mwegener-com
Copy link

Just import the hooks from the navigation/native not from the core. Like useRoute, useNavigation, usScrollToTop

Which hooks? All my used useState Hooks?

@zrina1314
Copy link

same problem

@tonyjaimep
Copy link

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 🤔

@jqn
Copy link

jqn commented Jan 28, 2022

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 #32114

@jqn
Copy link

jqn commented Jan 28, 2022

Ok, my issue wasn't the same as this one please view #31572 for a workaround

@feiyin0719
Copy link

it seem that it happened when ReactScrollView updateStateOnScroll

@000xuandu
Copy link

"react-native": "0.66.4"

The error message will show when scrolling Flatlist.

@vr0707
Copy link

vr0707 commented Mar 29, 2022

This same error to showed my logcat. But I worked on Curved navigation bar, after routing not worked and crashed and showed this error..

@pritam-digichal
Copy link

any progress in this issue?

@andvalsol
Copy link

I'm also experiencing the same issue, after debugging, here's the flow that originates the issue:

  1. NativeViewHierarchyManager gets called on the method createView() which passes the stateWrapper as null
  2. The call from 1) calls createView() from ViewManager (with a null stateWrapper).
  3. 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.

  1. On ReactSrollView OnLayout() function calls reactScrollTo()
  2. reactScrollTo() function calls updateStateOnScroll() 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;
          }
        });
  1. 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 set stateWrapper to null at first?
  • If the answer to the first question is yes, at what stage does the stateWrapper gets updated?

@rateshb
Copy link

rateshb commented Jul 14, 2022

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.

@Kstar0722
Copy link

any updates on this issue?

@abbasmashaddy72
Copy link

Any Update on This Issue, It Still Occurs from Me Also

@fogg4444
Copy link

This is happening for me, seeing the error unknown:FabricViewStateManager: setState called without a StateWrapper when clicking on a TextInput field on Android. Works just find on iOS. The keyboard closes immediately and that's the tell that there's something wrong.

@garrettg123
Copy link

garrettg123 commented Oct 31, 2022

Happening for me on Android app launch "react-native-reanimated": "2.3.1", crashes app.

@hamdidamar
Copy link

same here, any update?

1 similar comment
@suwu150
Copy link

suwu150 commented Dec 15, 2022

same here, any update?

@techgerm
Copy link

This is happening to us as well - we have the following dependencies that may be relevant:

"react-native": "0.66.4",
"react-native-reanimated": "2.13.0",
"@react-native-masked-view/masked-view": "^0.2.8",
"@react-navigation/bottom-tabs": "6.4.0",
"@react-navigation/drawer": "6.5.0",
"@react-navigation/native": "6.0.13",
"@react-navigation/native-stack": "6.9.1",

@gaberogan
Copy link
Contributor

gaberogan commented Feb 6, 2023

According to this, it looks like react-native-reanimated is not adding support for Fabric until v3.

Not sure if that's what is behind all this but it could be. I'm not sure why the error mentions Fabric when it should be disabled though 🤔

@herujest
Copy link

herujest commented Jun 7, 2023

any update on this?
it's happen in "react-native": "0.66.4".
I also have this that might be relevant:

"react-native-reanimated": "^3.2.0",
"react-native-safe-area-context": "^4.3.1",
"@react-navigation/bottom-tabs": "^6.0.3",
"@react-navigation/native": "^6.0.2",
"@react-navigation/stack": "^6.0.4",
"react-native-screens": "^3.13.1",

@vreoo
Copy link

vreoo commented Jun 22, 2023

I ma facing the same issue. Any Update?

I am using:

"react-native": "0.66.5",
"react-native-gesture-handler": "2.9.0",
"react-native-reanimated": "^3.3.0",
"react-native-safe-area-context": "^4.5.3",
"@react-navigation/bottom-tabs": "^6.4.1",
"@react-navigation/compat": "^5.3.20",
"@react-navigation/drawer": "^6.4.4",
"@react-navigation/native": "^6.0.12",
"@react-navigation/stack": "^6.2.3",

@ravindraguptacapgemini
Copy link

@cortinico Are you guys looking into this issue, as this still happening on latest 0.72.1 with android.

Copy link

github-actions bot commented Mar 8, 2024

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 github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Mar 8, 2024
Copy link

This issue was closed because it has been stalled for 7 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 15, 2024
@vreoo
Copy link

vreoo commented Mar 17, 2024

@cortinico The issue is not yet resolved! It shouldn't be closed as it's still happening and we didn't get any explanation for the behaviour at all.

@cortinico
Copy link
Contributor

@cortinico The issue is not yet resolved! It shouldn't be closed as it's still happening and we didn't get any explanation for the behaviour at all.

Please open a new issue and provide a valid reproducer, then we can look into it 👍
We also need to make sure the issue still happens on 0.73.x or not

@vreoo
Copy link

vreoo commented Mar 17, 2024

@cortinico The issue is not yet resolved! It shouldn't be closed as it's still happening and we didn't get any explanation for the behaviour at all.

Please open a new issue and provide a valid reproducer, then we can look into it 👍 We also need to make sure the issue still happens on 0.73.x or not

Fair enough, I totally agree with you. But It's very hard to reproduce this since it's only happening on production track + it happens with some users only (not all of them). We only get reports from the Google play console about the crashes with stack trace of the crash (along with device model and brand).

The only pattern I've noticed in my case, is that it happens only with the newest Android APIs (30 up to 34) not lower.

I was trying to reproduce this on my own many times, But I don't know where to start debugging for the issue or what to expect and what not or where to look and focus. In many cases the App is stuck on Splash screen after fresh install, or it opens then immediately crashes and never opens again. which doesn't happen to me at all when I try it myself (I tried many devices, but no luck).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests