【发布时间】:2020-08-04 03:24:03
【问题描述】:
state = {
title: []
}
render() {
return (<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="Dashboard"
component={Dashboard}
initialParams={{title:this.state.title}}
/>
</Stack.Navigator>
</NavigationContainer>}
export default class Dashboard extends React.Component {
constructor(prop) {
super(prop);
console.log( this.props.route.params)
this.state = {
search:"",
templist:this.props.route.params.title,
title: this.props.route.params.title}
**我想将状态中的标题(数组)传递给屏幕 但我没有在屏幕上看到数组**
【问题讨论】:
-
您是否在已放入的日志中获取参数?
-
不!我得到未定义的值
标签: reactjs react-native state react-navigation prop