使用说明
参考的github的:https://github.com/beefe/react-native-picker
第一步:npm install react-native-picker --save
第二步:react-native link
第二步android link不成功也和手动配置,步骤如下:
1:/android/settings

2:/android/app/bulid.gradle

3:/MainApplication


具体使用
导入组件:
import Picker from 'react-native-picker';
方法的使用
进入页面加载数据
componentWillMount() {
this.fetchData();
}
fetchData(){加载数据
Picker.init({
//数据源
pickerData: ["我不想买了","信息填写错误,重新拍","卖家缺货","其他原因",],
pickerConfirmBtnText:'确定',
pickerCancelBtnText:'取消',
pickerTitleText:'请选择取消订单的理由',
pickerBg:[245,245,245,1],
pickerFontSize:toDipsWidth(32),
onPickerConfirm: (pickedValue) => {
//自己想实现的方法
});
Picker.show();
}
补充、
组件弹出时,点击进入别的页面,弹框还存在,需要在跳转页面设置hide,该组件的使用可根据自己的需求使用,
网友评论