React native 导航到一个屏幕或另一个屏幕
我正在创建react本机应用程序。在此应用程序中,我希望将一个子视图导航到另一个子视图。这里我有applieduser的列表,其中包含了申请项目的用户的详细信息。单击该列表项,我将能够查看他/她的个人资料 我所做的:React native 导航到一个屏幕或另一个屏幕,react-native,react-native-navigation,React Native,React Native Navigation,我正在创建react本机应用程序。在此应用程序中,我希望将一个子视图导航到另一个子视图。这里我有applieduser的列表,其中包含了申请项目的用户的详细信息。单击该列表项,我将能够查看他/她的个人资料 我所做的: onUserClicked() { //Fetch Applied User And Show to screen console.log(this.props.data.uid); NavigationService.navigate('ViewActo
onUserClicked() {
//Fetch Applied User And Show to screen
console.log(this.props.data.uid);
NavigationService.navigate('ViewActorProfileScreen', { id: this.props.data.uid });
}
render() {
return (
<View>
<TouchableOpacity onPress={this.onUserClicked.bind(this)} >
<CardSection style={styles.container}>
<Text>{this.props.data.name}</Text>
<Text style={styles.titleStyle}>{this.props.data.category}</Text>
<Text style={styles.labelStyle}>
Gender - {this.props.data.gender}
</Text>
<Text style={styles.labelStyle}>Email - {this.props.data.email}</Text>
<Text style={styles.labelStyle}>Address - {this.props.data.address}</Text>
<Text style={styles.labelStyle}>Language : {this.props.data.language}</Text>
<Text style={styles.labelStyle}>Number - {this.props.data.mobile}</Text>
<Text style={styles.labelStyle}>{this.props.data.description}</Text>
<IconButton
onPress={this.onChatClicked.bind(this)}
iconname="comment"
lable="chat"
/>
</CardSection>
</TouchableOpacity>
</View>
);
}
rootStack.js
const MainStack = createStackNavigator(
{
HomeScreen: Home,
Login: LoginScreen,
SignUpScreen: UserSignUp,
ForgotPassword: ForgotPasswordScreen,
updateProfile: UserProfileScreen,
viewActorProfile:ViewActorProfileScreen
},
{
initialRouteName: 'HomeScreen'
}
);
Index.js
export * from './UpdateActorProfile';
export * from './ViewProject';
export * from './ViewActorProfileScreen';
export * from './AppliedProjectUsers';
export * from './AppliedUserList';
我已经创建了viewAcotrProfileScreen页面,该页面将包含用于查看配置文件的UI,我还将该文件添加到component/index.js文件中。但我无法导航到该页面。我是react native的新手,请引导我解决此问题。提前感谢您将导航名称更改为
NavigationService.navigate('viewActorProfile',{id:this.props.data.uid});}代码>
此外,你的主干是非常不一致的,会使你困惑,使你进一步犯这样的错误
主屏幕:主页、登录:登录屏幕、登录屏幕:用户注册、放弃密码:放弃密码屏幕、更新配置文件:用户配置文件屏幕、viewActorProfile:ViewActorProfileScreen
为了更好地组织,请确保一侧以屏幕结尾
不要混淆能否显示导航服务的代码
和您的根目录navigation@SGhaleb导航服务没有问题,因为我可以在另一个页面上导航/但在这里我不能。虽然我已经更新了代码。请检查并告知我当您单击onUserClicked()时是否有任何错误。
。还执行console.log(this.props.data.uid)代码>显示在控制台上?不,它显示UID在这些代码片段上似乎没有任何错误。那么ViewActorProfileScreen
组件和定义导航的根页面呢
export * from './UpdateActorProfile';
export * from './ViewProject';
export * from './ViewActorProfileScreen';
export * from './AppliedProjectUsers';
export * from './AppliedUserList';