1.0.9 • Published 5 years ago

react-native-hxenavigationbar v1.0.9

Weekly downloads
-
License
Apache-2.0
Repository
-
Last release
5 years ago

react-native-hxenavigationbar

npm npm Platform - iOS and Android

搜狐《狐小e》轻应用React Native默认导航栏组件。

react-native-hxenavigationbar

安装方法:

$ npm i react-native-hxenavigationbar --save

OBJECT参数说明:

参数类型必填说明
navigationObject屏幕导航属性
titleString标题
backgroundColorString导航栏背景色的RGBA色彩空间
whiteTintBoolean导航栏文字和图标的色调,true为白色调,false为黑色调
backButtonHandlerFunction点击返回按钮的回调
leftButtonObject左按钮对象(BUTTON OBJECT)
rightButtonObject右按钮对象(BUTTON OBJECT)
customButtonObject自定义按钮对象(BUTTON OBJECT)

如果backgroundColor值无效,将采用默认导航栏样式。whiteTint仅在backgroundColor有值时有效,且如果whiteTint值无效,将会根据backgroundColor值自动设置

BUTTON OBJECT参数说明:

参数类型必填说明
itemString, Number, Object按钮内容,具体分为“文本标题”(String,如:'按钮标题')、“本地图片”(Number,如:require('./image.png'))、“图片资源”(Object,如:{uri: 'http://www.image.com/image.png'}
handlerFunction点击按钮的回调

导航栏按钮从左至右依次为“返回按钮”、“左按钮”、“右按钮”、“自定义按钮”

示例代码:

import hxeNavigationBar from 'react-native-hxenavigationbar'
static navigationOptions = ({navigation}) => {
    return new hxeNavigationBar({
        navigation: navigation,
        title: '页面标题',
        backgroundColor: 'D65946CC',
        whiteTint: true,
        backButtonHandler: () => {
            console.log('点击了返回按钮');
        },
        leftButton: {
            item: '按钮标题',
            handler: () => {
                console.log('点击了左按钮');
            }
        },
        rightButton: {
            item: require('./image.png'),
            handler: () => {
                console.log('点击了右按钮');
            }
        },
        customButton: {
            item: {uri: 'http://www.image.com/image.png'},
            handler: () => {
                console.log('点击了自定义按钮');
            }
        }
    });
};

通过NavigationsetParams方法,修改hxeNavigationBarConfig可以动态改变导航栏

this.props.navigation.setParams({
    'hxeNavigationBarConfig': {
        navigation: this.props.navigation,
        title: '新页面标题',
        backButtonHandler: () => {
            console.log('又点击了返回按钮');
        }
    }
});

License

Apache-2.0 license.

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago