Skip to content

Commit

Permalink
feat(RN): 添加 config.window.navigationStyle 配置 close #675
Browse files Browse the repository at this point in the history
  • Loading branch information
Pines-Cheng committed Sep 26, 2018
1 parent 9648a60 commit fe94303
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/taro-router-rn/src/getWrappedScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@ function getWrappedScreen (Screen, Taro, globalNavigationOptions) {
static navigationOptions = ({navigation}) => {
const navigationOptions = getNavigationOptions(Screen.config)
const title = navigation.getParam('title') || navigationOptions.title || globalNavigationOptions.title
const rest = globalNavigationOptions.navigationStyle === 'custom' ? {header: null} : {}
return {
...rest,
headerTitle: <View style={{flexDirection: 'row', alignItems: 'center'}}>
{navigation.getParam('isNavigationBarLoadingShow') && <LoadingView/>}
<Text>{title}</Text>
<Text style={{fontSize: 17, fontWeight: 600}}>{title}</Text>
</View>,
headerTintColor: navigation.getParam('headerTintColor') || navigationOptions.headerTintColor || globalNavigationOptions.headerTintColor,
headerStyle: {
backgroundColor: navigation.getParam('backgroundColor') ||
(navigationOptions.headerStyle && navigationOptions.headerStyle.backgroundColor) ||
(globalNavigationOptions.headerStyle && globalNavigationOptions.headerStyle.backgroundColor)
backgroundColor: navigation.getParam('backgroundColor') || navigationOptions.backgroundColor || globalNavigationOptions.backgroundColor
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion packages/taro-router-rn/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ export const HEADER_CONFIG_MAP = {
navigationBarTitleText: 'title', // 导航栏标题文字内容
navigationBarTextStyle: 'headerTintColor', // 导航栏标题颜色,仅支持 black/white
navigationBarBackgroundColor: 'backgroundColor', // 导航栏背景颜色
enablePullDownRefresh: 'enablePullDownRefresh' // 是否全局开启下拉刷新,暂时放这里吧
enablePullDownRefresh: 'enablePullDownRefresh', // 是否全局开启下拉刷新,暂时放这里吧
navigationStyle: 'navigationStyle' // 导航栏样式,仅支持以下值:default 默认样式 custom 自定义导航栏,只保留右上角胶囊按钮
}

export function getNavigationOptions (config) {
Expand Down

0 comments on commit fe94303

Please sign in to comment.