You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

44 lines
1.1 KiB

import {
NativeModules,
Platform,
TurboModuleRegistry,
requireNativeComponent,
} from 'react-native'
import { getInstallationErrorMessage } from './installationError'
export const getNativeComponent = () => {
try {
switch (Platform.OS) {
case 'android':
case 'ios':
return requireNativeComponent('RNDatePicker')
default:
throw Error(
'react-native-date-picker is not supported on this platform'
)
}
} catch (e) {
if (global.ignoreDatePickerWarning) return null
throw Error(getInstallationErrorMessage())
}
}
export const getNativeModule = () => {
try {
switch (Platform.OS) {
case 'ios':
return NativeModules.RNDatePicker
case 'android':
return TurboModuleRegistry
? TurboModuleRegistry.get('RNDatePicker')
: NativeModules.RNDatePicker
default:
throw Error(
'react-native-date-picker is not supported on this platform'
)
}
} catch (e) {
if (global.ignoreDatePickerWarning) return null
throw Error(getInstallationErrorMessage())
}
}