react-native-datetimepicker / datetimepicker

React Native date & time picker component for iOS, Android and Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

View config getter callback for component `RNDateTimePicker` must be a function (received `undefined`)

AFDHAL2009 opened this issue Β· comments

πŸ‘‹ Hi!
I tried to use this picker in snack for test https://snack.expo.dev/ ,android working fine but ios it show this errors, can some help us to solve this issue and thanks
View config getter callback for component RNDateTimePicker must be a function (received undefined)

this simple test code for reproduce

import DateTimePicker from '@react-native-community/datetimepicker';
const App = () => {
  const [date, setDate] = useState(new Date(1598051730000));
return (
<View style={{flex:1}}>
<DateTimePicker
          testID="dateTimePicker"
          value={date}
          mode={'date'}
          is24Hour={true}
          onChange={() => alert('changed')}
        />
</View> 
}
export default App;

image

Hi, I have also encountered the same problem. My solution was to update the @react-native-community/datetimepicker dependency in package.json to the latest version, 7.6.3, and then the error disappeared. Although Snack indicates that it is not the recommended version for SDK 50.0.0, it does not affect the normal operation of the program.
{
"dependencies": {
"@react-native-community/datetimepicker": "7.6.3",
}
}
Hope it can help