Open zhouzhongyuan opened 7 years ago
入口文件: src/react-navigation.js
module.exports = {
// Core
get createNavigationContainer() {
return require('./createNavigationContainer').default;
},
}
这种写法的作用:有时候希望访问属性时能返回一个动态计算后的值, 或希望不通过使用明确的方法调用而显示内部变量的状态。
代码1:
var person ={
name: "zhongyuan",
}
代码2:
var person = {
get name(){
return "zhongyuan";
}
}
在取person.name
值的时候,效果是一样。
参考getter MDN
CardStack
的SceneComponent
是关键部分,是我们写的组件。StackNavigator
如何进行切换?即this.props.navigation.navigate('chat')
做了什么?
this.props.navigation.navigate
从哪儿来的?应该首先看
Answer:
navigate in react-navigation/src/addNavigationHelpers.js
addNavigationHelpers in react-navigation/src/createNavigationContainer.js
Answer:
navigate
dispatch
setState
It saves at StackRouter.js
.
StackNavigator
work?The simplest usage of StackNavigator
is like below:
cardStyle
work?TabNavigator
's tabBar?What determines the height of TabNavigator
's tabBar ? aka, the height of blue area in "Style" picture.
总计50px。
Answer: font-size(Text), margin(Text), padding(View)
goBack
work?navigation includes:
index
key
routeName
routes
v1 Roadmap
react-navigation github
react-navigation docs
Maximally Modular Apps with React Navigation - Eric Vicenti aka @ericvicenti at @ReactEurope 2017 - YouTube