Javascript 反应导航未定义错误
我有一个有趣的问题:所以我导入这个Javascript 反应导航未定义错误,javascript,react-native,react-navigation,expo,Javascript,React Native,React Navigation,Expo,我有一个有趣的问题:所以我导入这个 <TouchableOpacity onPress={() => this.props.navigation.navigate('Feed')} style={styles.buttonContainer}> <Text style={styles.buttonText}> LOGIN </Text> </TouchableOpacity>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Feed')} style={styles.buttonContainer}>
<Text style={styles.buttonText}>
LOGIN
</Text>
</TouchableOpacity>
this.props.navigation.navigate('Feed')}style={style.buttonContainer}>
登录
按钮,从我创建的表单,
我将其导入要加载表单的屏幕,如下所示:
<KeyboardAvoidingView behavior='padding' style={styles.container}>
<View style={styles.logo}>
<Text style={{fontSize: 64, color: '#34B3E4'}}>Partner<Text style={{fontSize: 64, color: '#0077B5'}}>Up</Text></Text>
<Text style={{fontSize: 13, opacity: 0.8, color: '#0077B5'}}>We connect you. You work easier.</Text>
</View>
<LoginForm/> <-------------------Here is the import
<View style={styles.accountLogin}>
<TouchableOpacity onPress={() => this.props.navigation.navigate('Forgot')}>
<Text style={{opacity: 0.9,color:'#34B3E4'}} >Forgot your password? </Text>
</TouchableOpacity>
</View>
</KeyboardAvoidingView>
合伙
我们为您转接。你工作容易些。
忘记密码了?
但是我的onpress函数不想中继到转换屏幕,并抛出一个未定义的错误
即使在我的路由器中,也无法在任何位置导入内容并呈现onpress功能:
Feed: {
screen: Feed,
navigationOptions: {
title: 'Mentor',
header:{
right: //Going to be the users profile picture
<Icon
onPress={() => this.props.navigation.navigate('Profile')}
name="user"
color='#0077B5'
size={30}
/>,
left: //Messages
<Icon
name="message"
color='#0077B5'
size={30}
/>,
titleStyle: { color: '#0077B5' },
}
}
},
提要:{
屏幕:Feed,
导航选项:{
标题:“导师”,
标题:{
右://将成为用户配置文件图片
this.props.navigation.navigate('Profile')}
name=“用户”
颜色=“#0077B5”
大小={30}
/>,
左://消息
,
标题样式:{颜色:'#0077B5'},
}
}
},
我到底要做什么
您需要将属性传递给子组件,以便 改变
<LoginForm/>
到
要使其在navigator中工作,请使用引用
<Navigator
ref='navigator'
...
/>
然后
<Icon
navigator={this.refs.navigator}
/>
您需要将属性传递给子组件,以便 改变
<LoginForm/>
到
要使其在navigator中工作,请使用引用
<Navigator
ref='navigator'
...
/>
然后
<Icon
navigator={this.refs.navigator}
/>
是否有未定义错误的日志?如果是,包括它。是否有未定义错误的日志?如果是这样,请包括它。谢谢你,这帮助我纠正了我的错误!当我在路由器中使用onpress功能时会怎么样?如何将属性传递给该特定图标?抛出类似的错误。谢谢,这帮助我修复了错误!当我在路由器中使用onpress功能时会怎么样?如何将属性传递给该特定图标?抛出类似的错误。