我如何使用 React Native 日期时间选择器
How can I use react native datetime picker
因为我想使用日期选择器,所以出现了这个错误
null is not an object (evaluating '_reactNative.NativeModules.RNDateTimePickerManager.getDefaultDisplayValue')
源代码
import React, {useState} from 'react';
import DateTimePicker from '@react-native-community/datetimepicker';
const ExpenseStepThree = () => {
const [date, setDate] = useState(new Date());
const onChange = (event, selectedDate) => {
const currentDate = selectedDate || date;
setDate(currentDate);
};
return <DateTimePicker value={date} onChange={onChange} />;
};
export default ExpenseStepThree;
解决问题的措施我做了
- pod-install
- npm install @react-native-community/datetimepicker --保存
设备规格
- Xcode 12.5
- "反应": "17.0.2",
- "@react-native-community/datetimepicker": "^3.5.2",
- "react-native": "0.66.1",
因为我想使用日期选择器,所以出现了这个错误
null is not an object (evaluating '_reactNative.NativeModules.RNDateTimePickerManager.getDefaultDisplayValue')
源代码
import React, {useState} from 'react';
import DateTimePicker from '@react-native-community/datetimepicker';
const ExpenseStepThree = () => {
const [date, setDate] = useState(new Date());
const onChange = (event, selectedDate) => {
const currentDate = selectedDate || date;
setDate(currentDate);
};
return <DateTimePicker value={date} onChange={onChange} />;
};
export default ExpenseStepThree;
解决问题的措施我做了
- pod-install
- npm install @react-native-community/datetimepicker --保存 设备规格
- Xcode 12.5
- "反应": "17.0.2",
- "@react-native-community/datetimepicker": "^3.5.2",
- "react-native": "0.66.1",