title: React Native Navigation pass dynamic data when rendering
body: <pre><code>changeTheme(){
  this.setState({darktheme:!this.state.darktheme})
  }
  
  render()
    return (
      &lt;NavigationContainer&gt;
        &lt;Stack.Navigator initialRouteName=&quot;Home&quot;&gt;
          &lt;Stack.Screen name=&quot;Home&quot; component={HomeScreen} darkT={this.state.darktheme==true} /&gt;
          &lt;Stack.Screen name=&quot;Settings&quot; component={SettingsScreen} changeTheme={this.changeTheme} darkT={this.state.darktheme==true} /&gt;
        &lt;/Stack.Navigator&gt;
      &lt;/NavigationContainer&gt;
    );
  }
  </code></pre>
  <p>In the settings page. I want to change the theme using <code>this.props.changeTheme()</code> it is supposed to change the state of the app and the whole app will re-render. But it doesn't work like that, the theme is not being changed. What am I doing wrong here?</p>
  <p>When I log <code>this.props.darkT</code> it returns false even after I called the function <code>changeTheme()</code></p>