react native Picker 使用详解
来源:互联网 发布:windows开发 编辑:程序博客网 时间:2024/06/07 17:37
Picker:选择器。
View props:使用View的属性。
onValueChange:选项发生变化时回调,参数:(value,position)
selectedValue:默认选中的值
enabled:android 设置为false禁用
mode:android dialog(默认值,对话框)、dropdown(下拉列表)
prompt:android 在Android的对话框模式中用作对话框的标题。
itemStyle:ios 每个选项的样式
demo:
/** * Created by on 2017/5/17. */import React, {Component} from 'react';import { StyleSheet, View, Picker, Text,} from 'react-native';export default class PickerDemo extends Component { static navigationOptions = { title: 'Picker', }; state = { language:'java', position:0, } render() { return ( <View style={{flex:1}}> <Text>value:{this.state.language}----position:{this.state.position}</Text> <Picker style={{backgroundColor:'red'}} itemStyle={{color:'blue'}} prompt='Picker' mode = 'dropdown' selectedValue={this.state.language} onValueChange={(lang,position) => this.setState({language: lang,position:position})}> <Picker.Item label="Java" value="java" /> <Picker.Item label="JavaScript" value="js" /> <Picker.Item label="Net" value="net" /> <Picker.Item label="ReactNative" value="rn" /> <Picker.Item label="c#" value="c" /> <Picker.Item label="php" value="php" /> </Picker> </View> ); }}
github下载地址
阅读全文
0 0
- react native Picker 使用详解
- React Native之Picker组件详解
- React-native 之Picker的使用
- React Native开源库react-native-image-crop-picker使用图解
- React Native开源库react-native-image-crop-picker使用图解
- react-native-image-picker
- react-native-image-picker
- react-native-image-picker
- 使用react-native-image-crop-picker上传图片
- react-native- images -crop-picker
- react-native-image-picker配置
- React Native 使用react-native-image-picker插件上传图片详细步骤
- React Native 使用react-native-image-picker库实现图片上传功能
- react native ActivityIndicator使用详解
- react native Button 使用详解
- react native Text 使用详解
- react native Switch使用详解
- react native ScrollView 使用详解
- mybatis配置文件中#和$的区别
- Windows 10 X64 安装 Oracle 12C INS-30131 错误有效解决!
- Java基础编程1—阶乘之和
- linux
- NFS服务器设置及mount命令挂载
- react native Picker 使用详解
- c++作业6——数组2
- SVN版本控制
- sublime text3 less和scss文件高亮显示
- c/c++中const、static的区别
- Java基础编程1—比较三个整数的大小
- Android 使用 Handler 避免内存泄漏的一些建议
- 侦察兵(特长生准备)
- CocoaPods中pod search失效解决办法