react-native + teaset(Drawer)实现侧边菜单
2024-09-02 21:35:52
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.效果图
最新文章
- ios 使用block中使用self可能产生的循环引用
- Requests库上传文件时UnicodeDecodeError: &#39;ascii&#39; codec can&#39;t decode byte错误解析
- Swift 实现下拉刷新 JxbRefresh
- [转]谈谈select, iocp, epoll,kqueue及各种网络I/O复用机制
- SetTimer函数的用法
- ios(苹果公司的移动操作系统)
- sqlplus部署
- uitableview 关于键盘挡住输入框解决方法
- 云栖大会day2总结 上午
- scrapy框架爬取妹子图片
- spring05-Spring事务管理
- Winform 基础一 panel
- springSecurity初步认识和执行流程
- jenkin 不必要的Execute shell执行失败,导致jenkins都失败的解决
- [hihoCoder] 第五十二周: 连通性&#183;一
- Codeforces Round #279 (Div. 2) B - Queue 水题
- 制作一个控制台小程序,要求:用户可以在控制到录入学生的姓名,当用户输入quit(不区分大小写)时,程序停止接收用户输入,并且显示出学生个数及姓名
- java 抽象类&;接口
- [转载]FFmpeg完美入门[4] - FFmpeg应用实例
- ActionContextCleanUp
热门文章
- c#读取LOG文件并解决读取提示被其他进程占用问题
- .NET Core Runtime ARM32 builds now available
- Request 部分功能
- python——入门系列(一)索引与切片
- win7 office2016 激活(2018.6.17测试可用)
- Python3 数字
- The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple -A Peak
- 洛谷——P1102 A-B数对
- oracle to_char FM099999
- C#外围工具资源