Reputation: 23
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}
**I want to pass the title(Array) in state to Screen But I am not getting the array in screen **
Upvotes: 0
Views: 1258
Reputation: 105
Stumbled into a similar problem. Made it work by stringifying the array I was trying to pass
{title: JSON.stringify(this.state.title)}
Upvotes: 1