Tenho uma estrutura de rotas
const AppNavigator = createStackNavigator({
FormLoginScreen: { screen: FormLogin },
FormCadastroScreen: { screen: FormCadastro },
FormBoasVindasScreen: { screen: FormBoasVindas },
FormPrincipalScreen: { screen: FormPrincipal },
ConversaScreen: { screen: Conversa },
});
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<Provider store={createStore(reducers, {}, applyMiddleware(ReduxThunk))}>
<AppNavigator />
</Provider>
);
}
}
在我的登录屏幕上,我有一个打开注册屏幕的按钮 这很完美 this.props.navigation.navigate(#39&; FormCadastroScreen&#39;)}&GT; 创建帐号
当我登录时,我的主屏幕包含两个选项卡,当我尝试使用其中一个选项卡中的导航时,它不再起作用。我该如何解决这个问题?
import React, { Component } from 'react';
import { View, Text, ListView, TouchableHighlight } from 'react-native';
export default class ContatosScreen extends Component {
renderRow(contato) {
return (
<TouchableHighlight onPress={() => this.props.navigation.navigate('FormCadastroScreen')}>
<View style={{ flex: 1, padding: 20, borderBottomWidth: 1, borderColor: "#CCC" }}>
<Text style={{ fontSize: 25 }}>{contato.nome}</Text>
<Text style={{ fontSize: 18 }}>{contato.email}</Text>
</View>
</TouchableHighlight>
);
}
render() {
return (
<ListView
enableEmptySections
dataSource={this.fonteDeDados}
renderRow={data => this.renderRow(data)}
/>
)
}
}
此处this.props.navigation.navigate(&#39; FormCadastroScreen&#39;)不再有效,如何点击此视图中的行或任何按钮以使用导航