Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

'use strict';

const DatePickerModule = require('../../BatchedBridge/NativeModules')
.DatePickerAndroid;
import type {Options, DatePickerOpenAction} from './DatePickerAndroidTypes';
import NativeDatePickerAndroid from './NativeDatePickerAndroid';

/**
* Convert a Date to a timestamp.
Expand Down Expand Up @@ -74,7 +73,7 @@ class DatePickerAndroid {
_toMillis(optionsMs, 'minDate');
_toMillis(optionsMs, 'maxDate');
}
return DatePickerModule.open(options);
return NativeDatePickerAndroid.open(options);
}

/**
Expand Down
21 changes: 21 additions & 0 deletions Libraries/Components/DatePickerAndroid/NativeDatePickerAndroid.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* Copyright 2004-present Facebook. All Rights Reserved.
*
* @flow strict-local
* @format
*/

'use strict';

import type {TurboModule} from 'RCTExport';
import * as TurboModuleRegistry from 'TurboModuleRegistry';
import type {Options, DatePickerOpenAction} from './DatePickerAndroidTypes';
import Platform from 'Platform';

export interface Spec extends TurboModule {
+open: (options: ?Options) => Promise<DatePickerOpenAction>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately some of the types in DatePickerAndroidTypes like Date isn't compatible yet with our codegen system, so for now let's modify these types to use Object (I'll modify it after I import to FB)

}

export default (Platform.OS === 'android'
? TurboModuleRegistry.getEnforcing<Spec>('DatePickerAndroid')
: TurboModuleRegistry.getEnforcing<Spec>('DatePickerIOS'));