react-native 史上最搓的登陆注册
来源:互联网 发布:一本好书 知乎 编辑:程序博客网 时间:2024/05/21 17:38
import React,{Compontent} from 'react';import{ AppRegistry,StyleSheet,Text,View,Dimensions,TextInput}from 'react-native';let widthOfMargin = Dimensions.get("window").width*0.05;export default class HelloWorldTest extends React.Component{ constructor(props){ super(props); this.state = { inputNum:'', inputPwd:'' }; this.updatePw=this.updatePw.bind(this); } updatePw(newText){ this.setState(()=>{ return{ inputPwd:newText, }; } ); } updateNum(newText){ this.setState(()=>{ return{ inputNum:newText, }; } ); } render(){ return( <View style={styles.container}> <TextInput placeholder={'请输入手机号'} onChangeText={ (newText)=>this.updateNum(newText) } /> <Text style={styles.textPromptStyle}> 您输入的手机号:{this.state.inputNum} </Text> <TextInput style={styles.textInputStyle} placeholder={'请输入密码'} password={true} onChangeText={this.updatePw} /> <Text style={styles.bigTextPrompt}> 确定 </Text> </View> ); }}let styles= StyleSheet.create( { container:{ flex:1, backgroundColor:'white' }, textInputStyle:{ margin:widthOfMargin, fontSize:20, backgroundColor:'gray' }, textPromptStyle:{ margin:widthOfMargin, fontSize:20 }, bigTextPrompt:{ margin:widthOfMargin, backgroundColor:'gray', color:'white', textAlign:'center', fontSize:30 } });AppRegistry.registerComponent('HelloWorldTest',()=>HelloWorldTest);
阅读全文
0 0
- react-native 史上最搓的登陆注册
- react-native 使用AsyncStorage实现长登陆
- 【React Native】React Native的bind方法
- React-Native的学习指南
- react-native 的简介
- react-native的Hello_World
- React Native的调试
- react-native的坑
- React-Native 的BackAndroid
- react native 的坑
- react-native的性能
- react-native的state
- React Native的征程
- 电商平台的搭建(SpringMVC+SpringSecurity/Validation+Redis+MySQL+React)----登陆注册模块
- 登陆注册的基础知识
- React&React-Native的实践的问题
- React/React Native框架的设计思想
- react/react native 组件的刷新机制
- python的购物车实例
- ucenter 的同步登录和退出
- Python爬虫——爬取中国高校排名前100名并写入MySQL
- 详解spring 每个jar的作用
- [DP] Codechef .Chef And Fibonacci Array
- react-native 史上最搓的登陆注册
- 【ZZULIOJ 2179:】 紧急营救 【spfa +枚举】
- 数据结构实验之排序六:希尔排序
- node异步流程控制
- Node.js 安装
- JAVA的Collections类中shuffle的用法
- 加快IDEA中MAVEN的pom文件下载资源的速度
- 树状数组(二维)
- HDOJ 2416 Treasure of the Chimp Island (BFS)