通过官网的react-native init myProject,并打开Android Studio的手机模拟器进行调试

下面的代码使用了 Text 、Image、View、TextInput和的react-native-modal-dropdown(下拉框)的组件,初步开发了一个登陆界面

1、Image的 source静态资源需要 require的引入,服务器资源的引入uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'

2、一行显示设置flexDirection: 'row'

3、android的输入框TextInput的

 <TextInput
style={{height: 40,width:200,padding: 0}}
underlineColorAndroid="transparent" 去掉下边框
keyboardType ='numeric' 调起的是数字键盘
placeholder="请输入手机号"
onChangeText={(text) => this.setState({text})}
secureTextEntry={true} 像password的输入
/>

  

/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/ import React, {
Component
} from 'react';
import {
Platform,
StyleSheet,
Text,
View,
Image,
TextInput
} from 'react-native'; import ModalDropdown from 'react-native-modal-dropdown'; const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' +
'Cmd+D or shake for dev menu',
android: 'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
}); type Props = {};
export default class App extends Component < Props > {
constructor(props) {
super(props);
this.state = {
text: '',
value:'',
c:'86'
}
}
render() {
let pic = {
uri: 'https://upload.wikimedia.org/wikipedia/commons/d/de/Bananavarieties.jpg'
};
let phone=[86,100,200,300]
return(
<View style={styles.container}>
<Image source={require('./img/img.jpg')} style={{width: 193, height: 110}} />
<Text style={styles.title}>
代理后台
</Text> <View style={{flexDirection: 'row',borderBottomColor:'#dbdbdb',borderBottomWidth:1}}>
<Text style={{marginRight:10}}>
国家/地区
</Text>
<ModalDropdown
options={['中国大陆', '香港','台湾','美国']}
dropdownStyle={{height: 300,width:200}}
textStyle={{height: 30,width:200,padding:0}}
defaultValue='中国大陆'
onSelect={(index,value)=>{
this.setState({
c:phone[index]
})
}}
/>
</View>
<View style={{flexDirection: 'row',borderBottomColor:'#dbdbdb',borderBottomWidth:1}}>
<Text style={{height: 40,marginRight:40,lineHeight:40}}>
+ {this.state.c}
</Text>
<TextInput
style={{height: 40,width:200,padding: 0}}
underlineColorAndroid="transparent"
keyboardType ='numeric'
placeholder="请输入手机号"
onChangeText={(text) => this.setState({text})}
secureTextEntry={true}
/>
</View>
<View style={{
borderBottomColor:'#dbdbdb',
borderBottomWidth:1
}}>
<TextInput
style={{height: 40,width:200,padding:0}}
keyboardType ='numeric'
underlineColorAndroid="transparent"
placeholder="请输入验证码"
onChangeText={(text) => this.setState({text})}
/>
</View>
<Text style={styles.instructions}>
{this.state.text}
</Text>
<Text style={styles.instructions}>
{instructions}
</Text>
</View>
);
}
} const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'flex-start',
paddingTop: 10,
alignItems: 'center',
backgroundColor: '#fff',
},
title: {
fontSize: 20,
textAlign: 'center',
color: '#000',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

最新文章

  1. 深度解析C语言int与unsigned int
  2. P1546 最短网络 Agri-Net
  3. db2look和db2move详解
  4. NFS服务器+客户端配置
  5. jquery总结06-动画事件04-自定义动画
  6. GithubPage 的简单使用
  7. hdu4782 Beautiful Soup (模拟)
  8. Java内存模型---并发编程网 - ifeve.com
  9. LVS包转发模型和调度算法(转)
  10. 番茄钟App(Pomodoro Tracker)
  11. char数组与char指针
  12. Layout.xml中控件的ID命名方式
  13. SWMM代码移植到64位平台
  14. C#入门经典第九章定义类-1
  15. EXCEL数据导入数据库实例(NPOI)
  16. Windows下用Composer安装Laravel步骤(集成php环境用phpStudy2016版本)
  17. 一步一步从原理跟我学邮件收取及发送 12.telnet命令行收一封信pop3
  18. 使用 HttpRequester 更方便的发起 HTTP 请求
  19. B. Obtaining the String(模拟)
  20. [转]ORACLE 11G 导出报错(EXP-00003)未找到段 (0,0) 的存储定义

热门文章

  1. 我的Java设计模式-策略模式
  2. Linux 系统裁剪笔记 4 (内核配置选项及删改)
  3. IOS开发之XCode学习009:UIViewController使用
  4. doT.js模板引擎及基础原理
  5. 细说Ajax跨域
  6. GridView添加事件监听和常用属性解析
  7. java中获取所有的请求参数
  8. java中获取项目在tomcat目录下的路径方法
  9. 金三银四,2018最新iOS面试题,由它可以搞定面试官?
  10. office 2013补丁包更新