React导航,ScreenStack仅接受Screen类型的子级

nnvyjq4y  于 2023-03-13  发布在  React
关注(0)|答案(1)|浏览(155)

按照以下说明将react navigation升级到版本6后,https://reactnavigation.org/docs/upgrading-from-5.x/
我得到错误,ScreenStack只接受类型屏幕的孩子,有什么想法我可以修复它?
App.js:

export default () => {

  const linking = {
    prefixes: ['', ''],
    config: {
      screens: {
        Register: 'register',
        MyVehicle: 'MyVehicle',
      },
    },
  };

  return (
    <Provider store={store}>
                <AppRootStack />
    </Provider>
  );
};

应用程序根堆栈:

const AppRootStack = () => {
  const { appState, appContext } = useContext(AppContext);
  const { isLoading } = appState;
  const { registerCallbackCompleted } = appContext;

  if (isLoading === true) {
    return <SplashScreen />;
  }
  return (
    <RootStackNavigator
      {...appState}
      registerCallbackCompleted={registerCallbackCompleted}
    />
  );
};

根堆栈导航器:

const RootStackNavigator = ({
   
    }) => {
         
      return (
        <RootStack.Navigator initialRouteName={initialRouteName} mode="modal">
    
          <RootStack.Screen
            name={AppRoutes.Register.Name}
            component={RegisterScreen}
            options={{
              title: AppRoutes.Register.Label,
              headerShown: false,
              animationEnabled: false,
            }}
          />
        </RootStack.Navigator>
      );
    };
soat7uwm

soat7uwm1#

对我来说,问题是react-native-screensv2.x,而不是v3.x

相关问题