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

Paste_Image.png
2:/android/app/bulid.gradle

Paste_Image.png
3:/MainApplication

Paste_Image.png

Paste_Image.png
具體使用
導(dǎo)入組件:
import Picker from 'react-native-picker';
方法的使用
進入頁面加載數(shù)據(jù)
componentWillMount() {
this.fetchData();
}
fetchData(){加載數(shù)據(jù)
Picker.init({
//數(shù)據(jù)源
pickerData: ["我不想買了","信息填寫錯誤,重新拍","賣家缺貨","其他原因",],
pickerConfirmBtnText:'確定',
pickerCancelBtnText:'取消',
pickerTitleText:'請選擇取消訂單的理由',
pickerBg:[245,245,245,1],
pickerFontSize:toDipsWidth(32),
onPickerConfirm: (pickedValue) => {
//自己想實現(xiàn)的方法
});
Picker.show();
}
補充、
組件彈出時,點擊進入別的頁面,彈框還存在,需要在跳轉(zhuǎn)頁面設(shè)置hide,該組件的使用可根據(jù)自己的需求使用,