如何访问抽屉的支架?

时间:2019-01-08 15:08:39

标签: react-native react-navigation react-navigation-drawer

我需要将变量传递到屏幕上,所以我做到了:

let x = 10
const Drawer = createDrawerNavigator({
  Screen1 : {
    screen: (props) => <Screen {...props} x={x} />
  },
  ...
},{
  contentComponent: props => <DrawerContent x={x}/> ,
  ...
})

它运行良好,并将x传递到所有屏幕以及抽屉内容部分。 但是我需要从AsyncStorage获取x,所以我需要以Drawer自身的componentDidMount之类的方式进行操作。那我该怎么做呢?

0 个答案:

没有答案