如何从组件获取状态到navigationOptions?

时间:2019-08-06 15:16:59

标签: reactjs react-native react-proptypes

有什么办法得到如下所示的东西吗?

App.js

const App = () => {
  ...
  const [state, setState] = useState('test');
  ...
}

App.navigationOptions = screenProps => ({
  headerRight: <Text>{i want the state value in here}</Text>,
});

有人可以提出任何建议吗?

0 个答案:

没有答案