android上方导航条跳转页面,Native Navigation导航组件的使用说明
目前稳定版本为1.0版本, 2.0是开发版, 暂时不要用.
支持单页直接跳转, 直接自带顶部导航栏配置(返回,标题栏和右侧按钮), 支持直接跳转到多Tab页面, 支持隐藏显示Tab页, 支持数字气泡.
[TODO 翻译RRN英文文档.]
[整合步骤]
[1. 页面注册]
app/screen.js 所有需要通过导航跳转的组件都需要在此文件中注册, 第一个参数为组件别名, 需要唯一, 建议带包名.
[2. 初始化App首页]
(一般用在首次启动App时)
[整个App重新导航到单个页面]
Navigation.startSingleScreenApp({
screen: {
screen: 'user.LoginPage',
},
passProps: {}, // 被跳转页面的属性 (可选)
portraitOnlyMode: true,// 只支持竖屏
});
[打开新的标签页App]
(只支持底部标签页)
Navigation.startTabBasedApp({
tabs: [
{
label: '标签', // iOS图标下的标题 (optional)
screen: 'example.FirstTabScreen', // unique ID registered with Navigation.registerScreen
icon: require('../img/one.png'), // 标签未选中时的图片 (optional on iOS)
selectedIcon: require('../img/one_selected.png'), // 标签选中时的图片 (optional, 仅支持iOS. Android使用 `tabBarSelectedButtonColor` 代替)
title: 'Screen One', // 导航栏标题 (optional)
navigatorStyle: {}, // override the navigator style for the tab screen, see "Styling the navigator" below (optional),
navigatorButtons: {} // override the nav buttons for the tab screen, see "Adding buttons to the navigator" below (optional)
},
{
label: 'Two',
screen: 'example.SecondTabScreen',
icon: require('../img/two.png'),
selectedIcon: require('../img/two_selected.png'),
title: 'Screen Two'
}
],
tabsStyle: { // optional, add this if you want to style the tab bar beyond the defaults
tabBarButtonColor: '#ffff00', // optional, change the color of the tab icons and text (also unselected)
tabBarSelectedButtonColor: '#ff9900', // optional, change the color of the selected tab icon and text (only selected)
tabBarBackgroundColor: '#551A8B' // optional, change the background color of the tab bar
},
appStyle: {
orientation: 'portrait' // Sets a specific orientation to the entire app. Default: 'auto'. Supported values: 'auto', 'landscape', 'portrait'
},
passProps: {}, // simple serializable object that will pass as props to all top screens (optional)
animationType: 'slide-down' // optional, add transition animation to root change: 'none', 'slide-down', 'fade'
});
[3. 在子页面中进行跳转]
[跳入](
this.props.navigator.push({
screen: 'example.ScreenThree', // unique ID registered with Navigation.registerScreen
title: undefined, // 导航栏标题 (可选)
titleImage: require('../../img/my_image.png'), //导航栏标题图片, 代替文字标题 (可选)
passProps: {}, // 被跳转页面的属性 (可选)
animated: true, // 是否显示动画 (可选)
backButtonTitle: undefined, // 返回按钮的文字 (可选)
backButtonHidden: false, // 是否隐藏返回按钮 (可选)
navigatorStyle: {}, // 覆盖默认导航栏风格 (可选)
navigatorButtons: {} // 覆盖默认导航栏按钮 (可选)
});
[跳出](
this.props.navigator.pop({
animated: true // does the pop have transition animation or does it happen immediately (可选)
});
[替换当前页(不可返回原页面)]
this.props.navigator.resetTo({
screen: 'example.ScreenThree', // unique ID registered with Navigation.registerScreen
title: undefined, // 导航栏标题 (可选)
titleImage: require('../../img/my_image.png'), //导航栏标题图片, 代替文字标题 (可选)
passProps: {}, // 被跳转页面的属性 (可选)
animated: true, // 是否显示动画 (可选)
navigatorStyle: {}, // 覆盖默认导航栏风格 (可选)
navigatorButtons: {} // 覆盖默认导航栏按钮 (可选)
});
[显示模态页面]
this.props.navigator.showModal({
screen: "example.ModalScreen", // unique ID registered with Navigation.registerScreen
title: "Modal", // title of the screen as appears in the nav bar (可选)
passProps: {}, // simple serializable object that will pass as props to the modal (可选)
navigatorStyle: {}, // override the navigator style for the screen, see "Styling the navigator" below (可选)
animationType: 'slide-up' // 'none' / 'slide-up' , appear animation for the modal (可选, default 'slide-up')
});
[关闭模态页面]
this.props.navigator.dismissModal({
animationType: 'slide-down' // 'none' / 'slide-down' , dismiss animation for the modal (可选, default 'slide-down')
});
[切换标签页的显示和隐藏]
this.props.navigator.toggleTabs({
to: 'hidden', // 必填参数, 'hidden' = hide tab bar, 'shown' = show tab bar
animated: true // does the toggle have transition animation or does it happen immediately (optional)
});
[切换到某个标签页](
this.props.navigator.switchToTab({
tabIndex: 0 // (可选) 如果不提供, 则当前屏幕的标签页将被选中
});
[显示数字气泡提示]
this.props.navigator.setTabBadge({
tabIndex: 0, // (可选) 不填写时默认添加到当前标签页
badge: 17 // 数字气泡提示, 设置为null会删除
});
[Android设置导航软键盘背景色]
TODO
[切换导航栏的显示和隐藏](
this.props.navigator.toggleNavBar({
to: 'hidden', // 必填参数, 'hidden' = hide tab bar, 'shown' = show tab bar
animated: true // does the toggle have transition animation or does it happen immediately (optional)
});
注: 因为咱们的项目之前有一些导航栏是自己定制的, 如果希望页面打开时就隐藏, 可以这样写:
export default class XXXPage extends Component {
static navigatorStyle = {
navBarHidden: false, // 隐藏默认的顶部导航栏
tabBarHidden: true, // 默认隐藏底部标签栏
};
[常见问题及解决]
[和内置navigator的区别]
navigator.replace/push等报错, 因为现在项目的写法都是直接传入组件, 而replace方法要改成用reset, push等则需要传入页面ID.
android上方导航条跳转页面,Native Navigation导航组件的使用说明相关推荐
- android上方导航条跳转页面,《成为大前端》系列 7. 多页面、页面跳转和Navigation模块...
介绍 开发过移动 Web 页面的同学都知道,单个页面由客户端的 UI 所承载,页面间的跳转也 不再是使用 window 和 location,也不是使用 a 标签,而且调用 Native 写好的 br ...
- 6.Android的学习(Intent跳转页面,活动之间传递数据)
Intent跳转页面 (1)使用显示Intent,首先创建一个空的活动,并且有布局,在onClick()下面添加: Intent里面的第一个参数是当前活动页面,第二参数是要跳转的活动页面.这段代码在当 ...
- HTML导航条的功能描述,ps制作网页导航条 忘了写文字描述就发了,步骤为:
网页导航条用ps怎么做 要详细一点的 忘了写文字描述就发了,步骤为: 新建一个矩形选区,就是设置好你想做的导航条的宽和高 如何用Photoshop制作网站的"导航栏" 用PS制作的 ...
- html5 箭头形状导航条,css实现带箭头的导航条
要实现这种导航条,首先要知道箭头是怎么做出来. http://www.cnblogs.com/daxiong/articles/3158630.html 这里说了用css做箭头的原理和实现. ...
- android文档导航条跳来跳去,莫名其妙的Android导航栏
iPhone的底部导航栏很是受欢迎,以至于在Android上面也有不少应用模仿.其实在开源界已经有很多不错的类似于这种导航栏的开源库,不过今天介绍的这款有些许不同,它有一个莫名的功能--在导航栏中插入 ...
- Android button 点击跳转页面
目录 准备工作 第一步:获取button 第二步:创建点击事件 准备工作 先创建一个类,来展示跳转后的页面 例如:MyActivity2 创建之后让该类继承 AppCompatActivity 类,并 ...
- Android开发之activity跳转页面失败的问题
今天做地址管理,跳转新建地址页面发现一个问题,这么也跳转不到下一个页面代码如下: /*** 跳转创建地址页面*/private void createAddress() {startActivityF ...
- android 点击item跳转页面,Android RecyclerView Item 点击事件,简单
在适配器中设置项的点击事件即可,如需跳转Activity,则需要intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK| Intent.FLAG_ACTIVITY_ ...
- android点击图片跳转页面底部,【报Bug】安卓底部选项卡webview模式下 点击跳转到某个页面后,会出现底部重叠的问题...
详细问题描述 (DCloud产品不会有明显的bug,所以你遇到的问题大都是在特定环境下才能重现的问题,请仔细描述你的环境和重现方式,否则DCloud很难排查解决你的问题) [内容] 重现步骤 [步骤] ...
最新文章
- 语音公司集体杀入AI芯片 2019场景落地战打响!
- delphi char与string比较
- git删除所有历史提交记录,只留下最新的干净代码
- RabbitMq--1
- 部署Symantec Antivirus 10.0网络防毒服务器之七
- mysql有没有模式,关于sql:没有数据的MySql导出模式
- JAVA 调用HTTP接口POST或GET实现方式
- python命令行参数解析模块argparse和docopt
- img标签过滤加fs模块实现图片文件缓存
- Scala 基础(7)—— 函数字面量和一等函数
- 一篇文章彻底弄懂Base64编码原理
- 引领数字医学高地,中山医院探索打造未来医院“新范式”
- 马士兵servletjsp视频教程——第二部分jsp笔记及源代码、servlet和jsp的通信
- 求原谅---好久没更新了
- 2个或2个以上路由器串联上网,在同一网段
- 奥鹏福建师范计算机应用作业,奥鹏福建师范【计算机应用基础】在线作业一、二答案在末尾...
- Matlab多子图绘制
- sticky footer布局,页面不足一屏底部footer固定在视窗底部,否则底部footer自动向下顺延
- The C10K Problem -- 翻译版
- 扫码点餐系统源码 外卖点餐小程序源码 点餐APP全套源码
热门文章
- 事情没有想象中那么难--JX官网首页3D粒子效果
- 判断一个整数的奇偶性php,【算法】- 判断一个整数是否是奇数
- b宝塔 centos端口更改_centos修改ssh默认端口号的方法示例
- gitee项目能用SVN拉取吗_基于SpringBoot的车牌识别系统(附项目地址)
- mongod: error while loading shared libraries: libcrypto.so.1.0.0: cannot open shared object file:
- MongoDB怎么做性能测试,看看这篇大神总结
- MySQL详细知识点总结 可以收藏啦
- 辞职腾讯去了小公司,从0到1搭建后端架构,工资就翻倍了
- mfc搜索新建access字段_vs2010MFC中使用ODBC链接ACCESS数据库,怎样编写查找功能?...
- php 常用时间处理函数,PHP date函数常用时间处理方法_PHP