使用說(shuō)明
參考的github的:https://github.com/beefe/react-native-picker
第一步:npm install react-native-picker --save
第二步:react-native link
第二步android link不成功也和手動(dòng)配置,步驟如下:
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';
方法的使用
進(jìn)入頁(yè)面加載數(shù)據(jù)
componentWillMount() {
this.fetchData();
}
fetchData(){加載數(shù)據(jù)
Picker.init({
//數(shù)據(jù)源
pickerData: ["我不想買了","信息填寫錯(cuò)誤,重新拍","賣家缺貨","其他原因",],
pickerConfirmBtnText:'確定',
pickerCancelBtnText:'取消',
pickerTitleText:'請(qǐng)選擇取消訂單的理由',
pickerBg:[245,245,245,1],
pickerFontSize:toDipsWidth(32),
onPickerConfirm: (pickedValue) => {
//自己想實(shí)現(xiàn)的方法
});
Picker.show();
}
補(bǔ)充情妖、
組件彈出時(shí)档押,點(diǎn)擊進(jìn)入別的頁(yè)面说贝,彈框還存在最楷,需要在跳轉(zhuǎn)頁(yè)面設(shè)置hide勤讽,該組件的使用可根據(jù)自己的需求使用厢漩,