gpt4 book ai didi

react-native - 如何修复 "Undefined is not an object(evaluating' Object.keys(routeConfigs )')"

转载 作者:行者123 更新时间:2023-12-04 15:46:49 28 4
gpt4 key购买 nike

我是 React-Native 的新开发人员。我正在尝试开发一个使用 React-Navigation 的应用程序。当我在手机上启动它时,会出现一个错误,我不知道为什么,因为我做了同样的“开始使用 react 导航”。

有人可以帮助我吗?

我安装了“react-navigation”和“react-navigation-gesture-handler”

import React from 'react'
import {StyleSheet, Image} from 'react-native'
import {createBottomTabNavigator, createAppContainer} from "react-navigation";
import CurrentList from "../Components/CurrentList";
import OthersList from "../Components/OthersList";

const CoursesTabNavigator = createBottomTabNavigator()(
{
CurrentList:{
screen: CurrentList,
navigationOptions:{
title:'Liste de la semaine',
tabBarIcon: () => {
return <Image source={require('../Images/ic_modifier_liste.jpg')} style={styles.icon}/>
}
}
},
OthersList:{
screen: OthersList,
navigationOptions:{
title: 'Anciennes listes',
tabBarIcon: () => {
return <Image source={require('../Images/ic_afficher_liste.png')} style={style.icon}/>
}
}
}
},
{
tabBarOptions: {
activeBackgroundColor: '#DDDDDD',
inactiveBackgroundColor: '#FFFFFF',
showLabel: false,
showIcon: true
}
}
);

const styles = StyleSheet.create({
icon: {
width: 30,
height: 30
}
})


export default createAppContainer(CoursesTabNavigator)

最佳答案

你的 routeConfigs 必须在你的 createBottomTabNavigator 函数中:

const CoursesTabNavigator = createBottomTabNavigator(
{ // <<== this is the object routeConfigs
CurrentList: {
screen: CurrentList,
navigationOptions: {
title: 'Liste de la semaine',
tabBarIcon: () => (
<Image
source={require('../Images/ic_modifier_liste.jpg')}
style={styles.icon}
/>
),
},
},
OthersList: {
screen: OthersList,
navigationOptions: {
title: 'Anciennes listes',
tabBarIcon: () => (
<Image
source={require('../Images/ic_afficher_liste.png')}
style={style.icon}
/>
),
},
},
},
{
tabBarOptions: {
activeBackgroundColor: '#DDDDDD',
inactiveBackgroundColor: '#FFFFFF',
showLabel: false,
showIcon: true,
},
},
);

关于react-native - 如何修复 "Undefined is not an object(evaluating' Object.keys(routeConfigs )')",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55422721/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com