react-native + teaset(Drawer)实现侧边菜单
1.代码
/**
* 购物车
*/
import React, {Component} from 'react';
import {
View,
Image,
} from 'react-native';
import { BaseContainer } from '../../../components';
import Icon from 'react-native-vector-icons/Ionicons'; //引入图标
import { Theme, Drawer, ListRow, Button } from 'teaset';
import { images } from '../../../res'; export default class ShopCarPage extends Component {
constructor(props) {
super(props); this.state = {
rootTransform: 'none'
};
} // 显示或隐藏侧边菜单(抽屉)
toggleMenu(side){
let { rootTransform } = this.state;
this.drawer = Drawer.open(this.renderDrawerMenu(), side, rootTransform);
} // 侧边菜单(抽屉)
renderDrawerMenu(){
return (
<View style={{backgroundColor: Theme.defaultColor, width: 260, flex: 1}}>
<View style={{height: 60}} />
<ListRow
icon={
<View style={{paddingRight: 12}}>
<Image style={{width: 30, height: 30, tintColor: Theme.primaryColor}} source={images.error} />
</View>
}
title='User name'
/>
<ListRow
icon={images.error}
title='Home'
/>
<ListRow
icon={images.error}
title='Store'
bottomSeparator='none'
/>
<View style={{flex: 1}} />
<Button type='link' size='sm' title='Hide' onPress={() => this.drawer && this.drawer.close()} />
</View>
);
} render() {
return (
<BaseContainer
hideLeft
title={'购物车'}
rightView={<Icon name='md-home' size={30} onPress={() => this.toggleMenu('left')} />}
>
</BaseContainer>
)
}
}
2.效果图
react-native + teaset(Drawer)实现侧边菜单的更多相关文章
- 虚拟机或真机调试React Native, 开启开发者菜单
虚拟机调试呼出开发者菜单,只需按下Ctrl+M组合键即可: 对于真机,通常摇晃手机可呼出,也可以在cmd输入adb shell input keyevent 82呼出菜单.如果还是不行,可能是系统管家 ...
- [RN] React Native 仿美团下拉筛选菜单控件
React Native 仿美团下拉筛选菜单控件 演示效果如下: 使用方法如下: 1.安装 npm install react-native-dropdownmenus --save react-na ...
- React Native填坑之旅--重新认识RN
如同黑夜里的一道光一样,就这么知道了F8. F8是每年一次Facebook每年一次的开发者大会.每次大会都会release相应的APP,iOS.Android都有.之前都是用Native开发的,但是2 ...
- React Native填坑之旅 -- 使用react-navigation代替Navigator
Navigator已经被React Native废弃了.也许你可以在另外的一个依赖库里react-native-deprecated-custom-components里找到.不过既然官方推荐的是re ...
- 【React Native开发】React Native控件之DrawerLayoutAndroid抽屉导航切换组件解说(13)
),请不要反复加群! 欢迎各位大牛,React Native技术爱好者增加交流!同一时候博客左側欢迎微信扫描关注订阅号,移动技术干货,精彩文章技术推送! 该DrawerLayoutAndroid组件封 ...
- React Native组件介绍
1.React Native目前已有的组件 ActivityIndicatorIOS:标准的旋转进度轮; DatePickerIOS:日期选择器: Image:图片控件: ListView:列表控件: ...
- windows 7下React Native环境配置
React Native 是 Facebook 推出的一个用 Java 语言就能同时编写 ios,android,以及后台的一项技术,它可以做到实时热更新 .FaceBook 也号称这们技术是 “Le ...
- React Native之坑总结(持续更新)
React Native之坑总结(持续更新) Genymotion安装与启动 之前我用的是蓝叠(BlueStack)模拟器,跑RN程序也遇到了一些问题,都通过搜索引擎解决了,不过没有记录. 但是Blu ...
- React Native APP结构探索
APP结构探索 我在Github上找到了一个有登陆界面,能从网上获取新闻信息的开源APP,想来研究一下APP的结构. 附上原网址:我的第一个React Native App 具体来讲,就是研究一个复杂 ...
随机推荐
- 第二篇:zone(区域)
什么是区域? 网络区域定义网络连接的信任级别(the level of trust for network connections).一个网络连接只能是一个区域的一部分,但一个区域可以包含许多网络连接 ...
- 从事前端开发必须要了解的CSS原理
从事Web前端开发的人都与CSS打交道很多,有的人也许不知道CSS是怎么去工作的,写出来的CSS浏览器是怎么样去解析的呢?当这个成为我们提高CSS水平的一个瓶颈时,是否应该多了解一下呢? 一.浏览器的 ...
- AC日记——codeforces Ancient Berland Circus 1c
1C - Ancient Berland Circus 思路: 求出三角形外接圆: 然后找出三角形三条边在小数意义下的最大公约数; 然后n=pi*2/fgcd; 求出面积即可: 代码: #includ ...
- 超越IEtab、网银支付助手,无需再次登陆的Firefox的IE插件
强烈推荐! fire-ie最大亮点就是:可以传递firefox下的cookie,从而避免了再次登陆或打开支付页面的繁琐. 在线安装:https://addons.mozilla.org/zh-CN/f ...
- magento 开启模板路径提示
1.进入后台system->configuration->,选择main Website 2.advanced->developer中,将Debug中的Template Path H ...
- [centos6.5] 把xampp的htdocs改为其他目录
vim /opt/lampp/etc/httpd.conf DocumentRoot "/opt/lampp/htdocs" 改为 DocumentRoot "/var/ ...
- 「kuangbin带你飞」专题十四 数论基础
layout: post title: 「kuangbin带你飞」专题十四 数论基础 author: "luowentaoaa" catalog: true tags: mathj ...
- UVA 699 The Falling Leaves (递归先序建立二叉树)
题目链接:http://acm.hust.edu.cn/vjudge/problem/19244 #include <iostream> #include <cstdio> # ...
- JAVA net 笔记
1.InetAddress 获取主机ip等 2.URL 3.URLConnection (url.openConnection() 创建对象) 4.BufferedReader 5.InputStre ...
- [BZOJ5463][APIO2018]铁人两项(圆方树DP)
题意:给出一张图,求满足存在一条从u到v的长度大于3的简单路径的有序点对(u,v)个数. 做了上一题[HDU5739]Fantasia(点双连通分量+DP),这个题就是一个NOIP题了. 一开始考虑了 ...