react-native-prompt
来源:互联网 发布:什么cms建站好用 编辑:程序博客网 时间:2024/06/05 14:33
/** * Sample React Native App * https://github.com/facebook/react-native * @flow */import React, { Component } from 'react';import { AppRegistry, StyleSheet, Text, View, Image} from 'react-native';// var arr = [// {// title:'1',// img:require("./img/未标题-1.png")// },// {// title:'2',// img:require("./img/未标题-2.png")// }// ];// import arr from './json';import json from './json';import Prompt from 'react-native-prompt';export default class D20170511 extends Component { constructor(props){ super(props); this.state = { isShow:false, message:'', } } render() { return ( <View style={styles.container}> <Text onPress={() => { this.setState({ isShow:true }); }}>{'点击输入'}</Text> <Text>{this.state.message}</Text> <Prompt visible={this.state.isShow} title={'输入框的标题'} placeholder={'请输入你的手机号码'} defaultValue={this.state.message} onCancel ={ () => { // alert('onCancel '); this.setState({ isShow:false }); } } onSubmit={ (new_value) => { // alert(new_value); // alert('onSubmit'); this.setState({ isShow:false, message:new_value }); } } cancelText={'取消'} submitText={'提交'} onChangeText={(data) => { if(data.length > 11){ // alert('手机号码必须为11位'); data = data.substring(0,11); this.setState({ isShow:false, message:data }); }else{ this.setState({ message:data }); } }} /> </View> ); }}const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#F5FCFF', }, welcome: { fontSize: 20, textAlign: 'center', margin: 10, }, instructions: { textAlign: 'center', color: '#333333', marginBottom: 5, },});AppRegistry.registerComponent('D20170511', () => D20170511);
0 0
- react-native-prompt
- react native
- React Native
- React Native
- React- Native
- react-native
- React Native
- React Native
- react native
- React Native
- react-native
- React Native
- react native
- React Native
- React Native
- React Native
- React Native
- react native
- 软件中的1、同步调用;2、回调;3、异步调用
- vs2008 控制台程序在win2000上无法运行的 提示缺少dll等问题
- 图例详解那道 setTimeout 与循环闭包的经典面试题
- android 再按一次退出程序
- JS事件--事件处理程序之DOM2事件处理程序
- react-native-prompt
- 剖析Docker文件系统:Aufs与Devicemapper
- 简单区分大端序和小端序(Little-Endian or Big-Endian)
- [李景山php] 深入理解PHP内核[读书笔记]--第三章:变量及数据类型--变量的作用域
- mvc模式的理解
- 360浏览器极速与兼容模式
- ACM 第八届山东省赛 A题 Return of the Nim
- 总结4
- 二路归并排序N