搞定了,是这个参数
...
navigationOptions: {
gesturesEnabled: true,
gestureResponseDistance: {
vertical: 150,
horizontal: 150
} ,
headerTintColor: '
...
搞定了,是这个参数
...
navigationOptions: {
gesturesEnabled: true,
gestureResponseDistance: {
vertical: 150,
horizontal: 150
} ,
headerTintColor: '
...
左滑返回只能从最左边开始滑才能返回,在中间滑是没用的,我想调整开始滑动的位置怎么调整呢
我前面试了下
某组件.defaultProps = {
...某组件.defaultProps,
foo: 'bar'
}
这样是可以的
如何全局的定制一个组件,比如像安卓和IOS有差异的那些,我想不用每次都传一些固定的东西,能不能只写一次,以后调用这个组件的时候就不用传某个参数了
关于列表下拉动态收齐列表头的那个动画效果,我参考楼主的写了一个,但是IOS的感觉帧数不高,有卡顿感,安卓的就很流畅,不知道楼主有没有这个问题
const MainPage = TabNavigator({
homework_index: {
screen: HomeworkIndex,
navigationOptions: {
tabBarLabel: '作业',
tabBarIcon: ({focused}) => {
return(<Icon size={26} style={styles.icon_style} name={focused ? 'ios-home' : 'ios-home-outline'} />)
}
}
},
notification_index: {
screen: NotificationIndex,
navigationOptions: {
tabBarLabel: '通知',
tabBarIcon: ({focused}) => {
return(<Icon size={26} style={styles.icon_style} name={focused ? 'ios-albums' : 'ios-albums-outline'} />)
}
}
},
self_learning_index: {
screen: SelfLearningIndex,
navigationOptions: {
tabBarLabel: '自学',
tabBarIcon: ({focused}) => {
return(<Icon size={26} style={styles.icon_style} name={focused ? 'ios-brush' : 'ios-brush-outline'} />)
}
}
},
personal_index: {
screen: PersonalIndex,
navigationOptions: {
tabBarLabel: '我的',
tabBarIcon: ({focused}) => {
return(<Icon size={26} style={styles.icon_style} name={focused ? 'ios-contact' : 'ios-contact-outline'} />)
}
}
}
}, {
tabBarPosition: 'bottom',
animationEnabled: false,
//tabBarComponent: TabBar,
tabBarOptions: {
activeTintColor: '#642100',
showIcon: true,
labelStyle: {
fontSize: 10,
marginTop: 0,
marginBottom: 2,
color: 'gray'
//paddingTop: 10
},
style: {
height: 50,
backgroundColor: 'white'
},
tabStyle: {
marginTop: 0
},
indicatorStyle: {
height: 0
}
}
}
)
const AppNavigation = StackNavigator({
main_page: {
screen: MainPage,
},
...
export default AppNavigation
怎么解决
在你的组件componentDidMont
之后,主动把params
写进去
componentDidMount() {
this.props.navigation.setParams({
foo: this.bar
})
}