Skip to content
Open
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
8 changes: 8 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Required because pr.yml uses `pull_request_target`, which
# otherwise checks out the base branch (master) instead of the
# PR head. Without this override, lint runs against master and
# PR-side fixes (or breaks) are invisible to the check.
# Mirrors the pattern already used in build-android.yml /
# build-ios.yml / test-android-*.yml.
ref: ${{ github.event.pull_request.head.sha }}

- name: Node
uses: actions/setup-node@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import androidx.annotation.NonNull;

import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReadableMap;

Expand All @@ -28,7 +29,13 @@ public void removeListeners(double type) {
}

@Override
public void openPicker(ReadableMap props){
public void openPicker(ReadableMap props, Callback onConfirm, Callback onCancel){
// Android delivers confirm/cancel to JS via the RCTDeviceEventEmitter
// (see DatePickerModuleImpl), so the callbacks supplied here are
// unused. They exist only to keep the TurboModule signature
// consistent with the iOS native module, where iOS *does* use the
// callbacks. Without them the spec would have to diverge by
// platform, which the codegen tooling does not allow.
module.openPicker(props);
}

Expand Down
8 changes: 6 additions & 2 deletions src/DatePickerIOS.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
style: [styles.datePickerIOS, props.style],
date: props.date ? props.date.toISOString() : undefined,
locale: props.locale ? props.locale : undefined,
maximumDate: props.maximumDate ? props.maximumDate.toISOString() : undefined,
minimumDate: props.minimumDate ? props.minimumDate.toISOString() : undefined,
maximumDate: props.maximumDate

Check failure on line 26 in src/DatePickerIOS.js

View workflow job for this annotation

GitHub Actions / Check / Lint

Replace `·?·props.maximumDate.toISOString()` with `⏎······?·props.maximumDate.toISOString()⏎·····`
? props.maximumDate.toISOString()

Check failure on line 27 in src/DatePickerIOS.js

View workflow job for this annotation

GitHub Actions / Check / Lint

Replace `·?·props.minimumDate.toISOString()` with `⏎······?·props.minimumDate.toISOString()⏎·····`
: undefined,
minimumDate: props.minimumDate
? props.minimumDate.toISOString()
: undefined,
theme: props.theme ? props.theme : 'auto',
}

Expand Down
6 changes: 5 additions & 1 deletion src/fabric/NativeRNDatePicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import { Double, UnsafeObject } from 'react-native/Libraries/Types/CodegenTypes'
export interface Spec extends TurboModule {
readonly getConstants: () => {}
closePicker(): void
openPicker(props: UnsafeObject): void
openPicker(
props: UnsafeObject,
onConfirm: (result: UnsafeObject) => void,
onCancel: () => void
): void
removeListeners(type: Double): void
addListener(eventName: string): void
}
Expand Down
7 changes: 6 additions & 1 deletion src/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,13 @@ export const useModal = ({ props, id }) => {
useEffect(() => {
if (shouldOpenModal(props, previousProps)) {
closing.current = false
// The TurboModule spec for `openPicker` declares 3 args because iOS
// native uses the callbacks directly. Android routes confirm/cancel
// through the `NativeEventEmitter` registered below, so the
// callbacks here are no-ops — they exist only to satisfy the
// strict arg-count check in the new architecture.
const params = Platform.select({
android: [props],
android: [props, () => {}, () => {}],
ios: [props, onConfirm, onCancel],
})
if (!params) throw Error('Unsupported platform')
Expand Down
Loading