Error: A component suspended while responding to synchronous input. React Native

73 Views Asked by At

I am new here. I have a problem with React Native. I got an error like this:

ERROR  Error: A component suspended while responding to synchronous input. This will cause the UI to be replaced with a loading indicator. To fix, updates that suspend should be wrapped with startTransition.

This error is located at:
    in SplashScreen (created by App)
    in RCTView (created by View)
    in View (created by GestureHandlerRootView)
    in GestureHandlerRootView (created by App)
    in App
    in RCTView (created by View)
    in View (created by AppContainer)
    in RCTView (created by View)
    in View (created by AppContainer)
    in AppContainer
    in [AppName](RootComponent), js engine: hermes
const App = () => {
  const [loading, setLoading] = React.useState(true);

  setTimeout(() => {
    setLoading(false);
  }, 3000);

  return (
      <GestureHandlerRootView
        style={{flex: 1, backgroundColor: COLORS.light.color}}>
        {loading ? (
          <SplashScreen />
        ) : (
          <>
            <NavigationContainer>
              <MainNavigation />
            </NavigationContainer>
          </>
        )}
      </GestureHandlerRootView>
  );
};

export default App;

const styles = StyleSheet.create({});

If i reload the app its working but when i kill and start from scratch i got this error.

0

There are 0 best solutions below