Я просмотрел свой проект, но не нашел файла, в котором свойство routes
было бы извлечено из объекта. Я изучаю трассировку стека, и ссылки на мои файлы проекта отсутствуют. Я не могу определить, где возникает эта ошибка. здесь вы можете найти всю трассировку стека:
TypeError: Cannot read property 'routes' of undefined
This error is located at:
in Navigator (created by KeyboardAwareNavigator)
in KeyboardAwareNavigator (at SceneView.tsx:98)
in StaticContainer
in StaticContainer (at SceneView.tsx:89)
in EnsureSingleNavigator (at SceneView.tsx:88)
in SceneView (at useDescriptors.tsx:125)
in RCTView (at CardContainer.tsx:199)
in RCTView (at CardContainer.tsx:198)
in RCTView (at CardSheet.tsx:33)
in ForwardRef(CardSheet) (at Card.tsx:526)
in RCTView (at createAnimatedComponent.js:144)
in AnimatedComponent (at createAnimatedComponent.js:194)
in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:508)
in PanGestureHandler (at GestureHandler.native.tsx:13)
in PanGestureHandler (at Card.tsx:502)
in RCTView (at createAnimatedComponent.js:144)
in AnimatedComponent (at createAnimatedComponent.js:194)
in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:498)
in RCTView (at Card.tsx:492)
in Card (at CardContainer.tsx:164)
in CardContainer (at CardStack.tsx:497)
in RCTView (at Screens.tsx:70)
in MaybeScreen (at CardStack.tsx:490)
in RCTView (at Screens.tsx:48)
in MaybeScreenContainer (at CardStack.tsx:388)
in CardStack (at StackView.tsx:433)
in KeyboardManager (at StackView.tsx:431)
in SafeAreaProviderCompat (at StackView.tsx:428)
in RCTView (at StackView.tsx:427)
in StackView (at createStackNavigator.tsx:82)
in StackNavigator (at NotificationStack.tsx:14)
in NotificationStack (at SceneView.tsx:98)
in StaticContainer
in StaticContainer (at SceneView.tsx:89)
in EnsureSingleNavigator (at SceneView.tsx:88)
in SceneView (at useDescriptors.tsx:125)
in RCTView (at BottomTabView.tsx:42)
in SceneContent (at BottomTabView.tsx:127)
in RCTView (at ResourceSavingScene.tsx:44)
in RCTView (at ResourceSavingScene.tsx:27)
in ResourceSavingScene (at BottomTabView.tsx:122)
in RCTView (at screens.native.js:131)
in ScreenContainer (at BottomTabView.tsx:106)
in RCTView (at BottomTabView.tsx:105)
in SafeAreaProviderCompat (at BottomTabView.tsx:104)
in BottomTabView (at createBottomTabNavigator.tsx:41)
in BottomTabNavigator (at PaperPlaneStack.tsx:15)
in PaperPlaneStack (at SceneView.tsx:98)
in StaticContainer
in StaticContainer (at SceneView.tsx:89)
in EnsureSingleNavigator (at SceneView.tsx:88)
in SceneView (at useDescriptors.tsx:125)
in RCTView (at CardContainer.tsx:199)
in RCTView (at CardContainer.tsx:198)
in RCTView (at CardSheet.tsx:33)
in ForwardRef(CardSheet) (at Card.tsx:526)
in RCTView (at createAnimatedComponent.js:144)
in AnimatedComponent (at createAnimatedComponent.js:194)
in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:508)
in PanGestureHandler (at GestureHandler.native.tsx:13)
in PanGestureHandler (at Card.tsx:502)
in RCTView (at createAnimatedComponent.js:144)
in AnimatedComponent (at createAnimatedComponent.js:194)
in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:498)
in RCTView (at Card.tsx:492)
in Card (at CardContainer.tsx:164)
in CardContainer (at CardStack.tsx:497)
in RCTView (at Screens.tsx:70)
in MaybeScreen (at CardStack.tsx:490)
in RCTView (at Screens.tsx:48)
in MaybeScreenContainer (at CardStack.tsx:388)
in CardStack (at StackView.tsx:433)
in KeyboardManager (at StackView.tsx:431)
in SafeAreaProviderCompat (at StackView.tsx:428)
in RCTView (at StackView.tsx:427)
in StackView (at createStackNavigator.tsx:82)
in StackNavigator (at AppStack.tsx:27)
in AppStack (at SceneView.tsx:98)
in StaticContainer
in StaticContainer (at SceneView.tsx:89)
in EnsureSingleNavigator (at SceneView.tsx:88)
in SceneView (at useDescriptors.tsx:125)
in RCTView (at CardContainer.tsx:199)
in RCTView (at CardContainer.tsx:198)
in RCTView (at CardSheet.tsx:33)
in ForwardRef(CardSheet) (at Card.tsx:526)
in RCTView (at createAnimatedComponent.js:144)
in AnimatedComponent (at createAnimatedComponent.js:194)
in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:508)
in PanGestureHandler (at GestureHandler.native.tsx:13)
in PanGestureHandler (at Card.tsx:502)
in RCTView (at createAnimatedComponent.js:144)
in AnimatedComponent (at createAnimatedComponent.js:194)
in ForwardRef(AnimatedComponentWrapper) (at Card.tsx:498)
in RCTView (at Card.tsx:492)
in Card (at CardContainer.tsx:164)
in CardContainer (at CardStack.tsx:497)
in RCTView (at Screens.tsx:70)
in MaybeScreen (at CardStack.tsx:490)
in RCTView (at Screens.tsx:48)
in MaybeScreenContainer (at CardStack.tsx:388)
in CardStack (at StackView.tsx:433)
in KeyboardManager (at StackView.tsx:431)
in SafeAreaProviderCompat (at StackView.tsx:428)
in RCTView (at StackView.tsx:427)
in StackView (at createStackNavigator.tsx:82)
in StackNavigator (at AppContainer.tsx:48)
in EnsureSingleNavigator (at BaseNavigationContainer.tsx:288)
in ForwardRef(BaseNavigationContainer) (at NavigationContainer.tsx:66)
in ThemeProvider (at NavigationContainer.tsx:65)
in ForwardRef(NavigationContainer) (at AppContainer.tsx:47)
in AppContainer (at App.tsx:85)
in PersistGate (at App.tsx:84)
in Provider (at App.tsx:83)
in RNCSafeAreaView (at src/index.tsx:26)
in SafeAreaProvider (at App.tsx:82)
in RCTView (at ScreenSwitcher.js:87)
in RCTView (at ScreenSwitcher.js:86)
in ScreenSwitcher (at App.tsx:81)
in App (at renderApplication.js:45)
in RCTView (at AppContainer.js:109)
in RCTView (at AppContainer.js:135)
in AppContainer (at renderApplication.js:39)
Navigator.getDerivedStateFromProps
createNavigator.js:34:8
applyDerivedStateFromProps
ReactNativeRenderer-dev.js:7819:21
mountClassInstance
ReactNativeRenderer-dev.js:8559:4
updateClassComponent
ReactNativeRenderer-dev.js:13491:4
beginWork$1
ReactNativeRenderer-dev.js:15881:13
invokeGuardedCallbackImpl
ReactNativeRenderer-dev.js:286:9
invokeGuardedCallback
ReactNativeRenderer-dev.js:497:30
beginWork$$1
ReactNativeRenderer-dev.js:22028:6
performUnitOfWork
ReactNativeRenderer-dev.js:20871:11
workLoopSync
ReactNativeRenderer-dev.js:20848:21
Я подозреваю, что проблема связана с @react-navigation/bottom-tabs
. Когда я нажимаю кнопку NotificationButton
, появляется указанная выше ошибка:
const Tab = createBottomTabNavigator();
export default function PaperPlaneStack() {
return (
<Tab.Navigator
initialRouteName="ReceivePaperPlaneScreen"
tabBar={props => (
<CustomBottomTabBar {...props} routeState={props.state} />
)}>
<Tab.Screen
name="TakePaperPlaneScreen"
component={TakePaperPlaneScreen}
options={{
tabBarButton: props => <MainActionButton {...props} />,
}}
/>
<Tab.Screen
name="ReceivePaperPlaneScreen"
component={ReceivePaperPlaneScreen}
options={{
tabBarButton: props => <MapButton {...props} />,
}}
/>
<Tab.Screen
name="NotificationScreen"
component={NotificationStack}
options={{
tabBarButton: props => <NotificationButton {...props} />,
}}
/>
</Tab.Navigator>
);
}