所以我只用一个文件编辑了所有内容,但我似乎还是无法使它工作。
目录结构:
LoginScreen.js
import { StackNavigator, } from 'react-navigation';
import DrawerScreen from '../Containers/Drawer.js';
// PJDS all-in
import HomeScreen from '../screens/HomeScreen.js';
import SettingsScreen from '../screens/SettingsScreen.js';
import { DrawerNavigator } from 'react-navigation';
const Navigation=DrawerNavigator({
Dashboard: {
screen: HomeScreen
},
Course: {
screen: SettingsScreen
},
})
// PJDS end
class LoginScreen extends Component {
constructor(props){
super(props)
}
showLogin(props){
let { onLogin, onLogout, onUser, handleSubmit, auth } = props
if(auth.access_token === '') {
return (
<View >
<Field style={styles.input} autoCapitalize="none" placeholder="Email Cu" component={TInput} name={'email'} />
<Field style={styles.input} autoCapitalize="none" placeholder="Password" secureTextEntry={true} component={TInput} name={'password'} />
<Button
title = "Login"
color = "#236CF5"
style = {{backgroundColor:'#F8F8F8'}}
onPress = {handleSubmit(onLogin)}
/>
</View>
)
}
else {
return (
<Navigation />
)
}
}
render(){
return this.showLogin(this.props)
}
}
单击登录后,只会显示一个空白屏幕,没有任何错误,但是向右滑动不会显示抽屉。
如果有人知道这里的问题,我会很高兴的。
答案 0 :(得分:0)
尚未在您的方法中的任何地方定义numsum = sum(set(x_list + y_list))
变量。
由于您已经将屏幕绑定到233168
,导航器,因此您可以访问道具33165
,而道具navigate
则具有方法{{1} }。
react-navigation
答案 1 :(得分:0)
您应该为抽屉导航器分配宽度
const Navigation = DrawerNavigator({
Home: {
screen: Home
},
Login: {
screen: LoginScreen,
},
}, {
drawerWidth: 300,
drawerBackgroundColor: '#00234b',
contentOptions: {
inactiveTintColor: '#FAFAFA',
activeTintColor: '#2bbfed',
activeBackgroundColor: '#00152d',
labelStyle: {
fontFamily: 'Montserrat-Medium'
}
},
});
要访问抽屉式导航器,您应该执行以下操作:
.....
onPress={() => this.props.navigation.navigate('DrawerToggle')}