react native Modal 使用详解
来源:互联网 发布:合肥关键词优化 编辑:程序博客网 时间:2024/06/05 03:37
Modal 是可以覆盖在原生视图上。
属性:
animationType:显示和隐藏的动画
- slide:从底部弹出
- fade:渐隐渐显
- none:无
onRequestClose:android 按返回键时回调。
onShow:modal显示时回调。
transparent:背景是否透明,默认为白色。
visible:是否显示。
/** * Created by on 2017/5/8. */import React, {Component} from 'react';import { StyleSheet, View, Modal, Button, Alert,} from 'react-native';export default class ModalDemo extends Component { static navigationOptions = { title: 'Modal', }; state = { visible: false, transparent: true, } render() { return ( <View style={{flex:1}}> <Button title='显示Modal' onPress={()=>{this.setState({visible:true})}}/> <Modal visible={this.state.visible} transparent={this.state.transparent} onRequestClose={()=>{ Alert.alert("Modal has been closed."); }} onShow={()=>{ Alert.alert("Modal has been show."); }}> <View style={{flex:1,justifyContent:'center',alignItems:'center',backgroundColor:'rgba(0, 0, 0, 0.3)'}}> <View style={{height:200,width:275,backgroundColor:'white'}}> <Button title='关闭Modal' onPress={()=>{this.setState({visible:false})}}/> <Button title={this.state.transparent?'不透明':'透明'} onPress={()=>{this.setState({transparent:!this.state.transparent})}}/> </View> </View> </Modal> </View> ); }}
github下载地址
0 0
- react native Modal 使用详解
- react-native Modal使用
- React-Native 组件之 Modal的使用详解
- React Native 控件之 Modal 详解
- React Native 之 Modal介绍与使用
- React-Native 之 Modal介绍与使用
- react native Modal使用以及封装
- react-native Modal的学习与使用
- React-Native 之 Modal介绍与使用
- React-Native 之 Modal介绍与使用
- React Native使用Modal自定义分享界面
- react-native-modal-alert
- react-native modal封装
- React Native 自定义modal
- React Native Modal踩坑
- 【React Native开发】React Native 控件之Modal详解-Android/iOS双平台通用(56)
- react-native modal自定义对话框
- react native Modal 实现ActionSheet
- VMware 安装kali——linux
- 运行时(runtime)-方法交换
- USB/File system相关内核配置
- GObject消息系统之Closures
- angularJs页面弹框的实现
- react native Modal 使用详解
- Python学习笔记(一)—变量与数据类型
- 带你入门 CSS Grid 布局
- Eclipse 版本对应的 JDK版本要求
- js与android交互
- Redis常见7种使用场景(PHP实战)
- spring-boot--使用thymeleaf模板
- GObject消息系统之Signals
- 补一