-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/refactor availability time picker #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
SpencerJohnson9904
merged 13 commits into
main
from
feature/refactor-availability-time-picker
Dec 8, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
80eb323
update time picker modal style and event handlers
CharlesBither f4d7e91
fix time strings when creating Availability object, fix time picker s…
CharlesBither 6a01ecf
update day of week icons
CharlesBither 17afbc3
Merge branch 'main' into feature/refactor-availability-time-picker
CharlesBither a046357
remove react-native-paper-dates package
CharlesBither e99f6cf
use loading prop on save button instead of rendering a chile Activity…
CharlesBither 6a8d14a
add patch for RN date picker package to fix Module provider RNDatePic…
CharlesBither c9ae694
add comments
CharlesBither be8aba9
Merge branch 'main' into feature/refactor-availability-time-picker
CharlesBither 8102556
update package-lock.json
CharlesBither c51d879
Merge branch 'main' of https://github.com/CornucopiaApp/Cornucopia in…
SpencerJohnson9904 e27568d
sync package-lock
SpencerJohnson9904 32e681b
dependency fixes
SpencerJohnson9904 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,174 @@ | ||
| diff --git a/node_modules/react-native-date-picker/android/src/main/java/com/henninghall/date_picker/DatePickerModuleImpl.java b/node_modules/react-native-date-picker/android/src/main/java/com/henninghall/date_picker/DatePickerModuleImpl.java | ||
| index b8a2a80..736a20c 100644 | ||
| --- a/node_modules/react-native-date-picker/android/src/main/java/com/henninghall/date_picker/DatePickerModuleImpl.java | ||
| +++ b/node_modules/react-native-date-picker/android/src/main/java/com/henninghall/date_picker/DatePickerModuleImpl.java | ||
| @@ -30,23 +30,29 @@ public class DatePickerModuleImpl { | ||
| ApplicationStarter.initialize(context, false); // false = no need to prefetch on time data background tread | ||
| } | ||
|
|
||
| - public void openPicker(ReadableMap props){ | ||
| + public void openPicker(ReadableMap props, Callback onConfirm, Callback onCancel){ | ||
| final PickerView picker = createPicker(props); | ||
| - Callback onConfirm = new Callback() { | ||
| + Callback onConfirmCallback = new Callback() { | ||
| @Override | ||
| public void invoke(Object... objects) { | ||
| Emitter.onConfirm(picker.getDate(), picker.getPickerId()); | ||
| + if (onConfirm != null) { | ||
| + onConfirm.invoke(picker.getDate()); | ||
| + } | ||
| } | ||
| }; | ||
|
|
||
| - Callback onCancel = new Callback() { | ||
| + Callback onCancelCallback = new Callback() { | ||
| @Override | ||
| public void invoke(Object... objects) { | ||
| Emitter.onCancel(picker.getPickerId()); | ||
| + if (onCancel != null) { | ||
| + onCancel.invoke(); | ||
| + } | ||
| } | ||
| }; | ||
|
|
||
| - dialog = createDialog(props, picker, onConfirm, onCancel); | ||
| + dialog = createDialog(props, picker, onConfirmCallback, onCancelCallback); | ||
| dialog.show(); | ||
| } | ||
|
|
||
| diff --git a/node_modules/react-native-date-picker/android/src/newarch/java/com/henninghall/date_picker/DatePickerModule.java b/node_modules/react-native-date-picker/android/src/newarch/java/com/henninghall/date_picker/DatePickerModule.java | ||
| index 0fce9a7..d56b203 100644 | ||
| --- a/node_modules/react-native-date-picker/android/src/newarch/java/com/henninghall/date_picker/DatePickerModule.java | ||
| +++ b/node_modules/react-native-date-picker/android/src/newarch/java/com/henninghall/date_picker/DatePickerModule.java | ||
| @@ -2,6 +2,7 @@ package com.henninghall.date_picker; | ||
|
|
||
| import androidx.annotation.NonNull; | ||
|
|
||
| +import com.facebook.react.bridge.Callback; | ||
| import com.facebook.react.bridge.ReactApplicationContext; | ||
| import com.facebook.react.bridge.ReadableMap; | ||
|
|
||
| @@ -28,8 +29,8 @@ public class DatePickerModule extends NativeRNDatePickerSpec { | ||
| } | ||
|
|
||
| @Override | ||
| - public void openPicker(ReadableMap props){ | ||
| - module.openPicker(props); | ||
| + public void openPicker(ReadableMap props, Callback onConfirm, Callback onCancel){ | ||
| + module.openPicker(props, onConfirm, onCancel); | ||
| } | ||
|
|
||
| @Override | ||
| diff --git a/node_modules/react-native-date-picker/ios/RNDatePickerManager.h b/node_modules/react-native-date-picker/ios/RNDatePickerManager.h | ||
| index 6a4f206..b6de05c 100644 | ||
| --- a/node_modules/react-native-date-picker/ios/RNDatePickerManager.h | ||
| +++ b/node_modules/react-native-date-picker/ios/RNDatePickerManager.h | ||
| @@ -8,7 +8,14 @@ | ||
| #import <React/RCTConvert.h> | ||
| #import <React/RCTViewManager.h> | ||
|
|
||
| +#ifdef RCT_NEW_ARCH_ENABLED | ||
| +#import <RNDatePickerSpecs/RNDatePickerSpecs.h> | ||
| +#endif | ||
| + | ||
| @interface RNDatePickerManager : RCTViewManager | ||
| +#ifdef RCT_NEW_ARCH_ENABLED | ||
| +<NativeRNDatePickerSpec> | ||
| +#endif | ||
|
|
||
| @property (strong, nonatomic) UIViewController *topViewController; | ||
|
|
||
| diff --git a/node_modules/react-native-date-picker/ios/RNDatePickerManager.mm b/node_modules/react-native-date-picker/ios/RNDatePickerManager.mm | ||
| index da42873..77700f7 100644 | ||
| --- a/node_modules/react-native-date-picker/ios/RNDatePickerManager.mm | ||
| +++ b/node_modules/react-native-date-picker/ios/RNDatePickerManager.mm | ||
| @@ -234,6 +234,22 @@ - (double) getPickerHeight :(UIView *) alertView | ||
| return 216; | ||
| } | ||
|
|
||
| +// New Architecture support - provide module instance to TurboModule system | ||
| ++ (BOOL)requiresMainQueueSetup { | ||
| + return NO; | ||
| +} | ||
| + | ||
| +#ifdef RCT_NEW_ARCH_ENABLED | ||
| +// Implement the Spec protocol methods required by TurboModule | ||
| +- (void)getConstants:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject { | ||
| + resolve(@{}); | ||
| +} | ||
| + | ||
| +- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:(const facebook::react::ObjCTurboModule::InitParams &)params { | ||
| + return std::make_shared<facebook::react::NativeRNDatePickerSpecJSI>(params); | ||
| +} | ||
| +#endif | ||
| + | ||
| @end | ||
|
|
||
|
|
||
| diff --git a/node_modules/react-native-date-picker/src/DatePickerAndroid.js b/node_modules/react-native-date-picker/src/DatePickerAndroid.js | ||
| index a8a1e71..3cf1499 100644 | ||
| --- a/node_modules/react-native-date-picker/src/DatePickerAndroid.js | ||
| +++ b/node_modules/react-native-date-picker/src/DatePickerAndroid.js | ||
| @@ -67,9 +67,10 @@ export const DatePickerAndroid = React.memo((props) => { | ||
| onStateChange: onSpinnerStateChanged, | ||
| } | ||
|
|
||
| - useModal({ props: modifiedProps, id: thisId }) | ||
| - | ||
| - if (props.modal) return null | ||
| + if (props.modal) { | ||
| + useModal({ props: modifiedProps, id: thisId }) | ||
| + return null | ||
| + } | ||
|
|
||
| return <NativeComponent {...modifiedProps} /> | ||
| }) | ||
| diff --git a/node_modules/react-native-date-picker/src/DatePickerIOS.js b/node_modules/react-native-date-picker/src/DatePickerIOS.js | ||
| index 987cbca..aa40b72 100644 | ||
| --- a/node_modules/react-native-date-picker/src/DatePickerIOS.js | ||
| +++ b/node_modules/react-native-date-picker/src/DatePickerIOS.js | ||
| @@ -28,9 +28,10 @@ export const DatePickerIOS = (props) => { | ||
| theme: props.theme ? props.theme : 'auto', | ||
| } | ||
|
|
||
| - useModal({ props: modifiedProps, id: undefined }) | ||
| - | ||
| - if (props.modal) return null | ||
| + if (props.modal) { | ||
| + useModal({ props: modifiedProps, id: undefined }) | ||
| + return null | ||
| + } | ||
|
|
||
| return ( | ||
| <NativeComponent | ||
| diff --git a/node_modules/react-native-date-picker/src/fabric/NativeRNDatePicker.ts b/node_modules/react-native-date-picker/src/fabric/NativeRNDatePicker.ts | ||
| index 1633d7a..742c255 100644 | ||
| --- a/node_modules/react-native-date-picker/src/fabric/NativeRNDatePicker.ts | ||
| +++ b/node_modules/react-native-date-picker/src/fabric/NativeRNDatePicker.ts | ||
| @@ -5,7 +5,7 @@ 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 | ||
| } | ||
| diff --git a/node_modules/react-native-date-picker/src/modal.js b/node_modules/react-native-date-picker/src/modal.js | ||
| index fe02e33..b43747f 100644 | ||
| --- a/node_modules/react-native-date-picker/src/modal.js | ||
| +++ b/node_modules/react-native-date-picker/src/modal.js | ||
| @@ -76,12 +76,7 @@ export const useModal = ({ props, id }) => { | ||
| useEffect(() => { | ||
| if (shouldOpenModal(props, previousProps)) { | ||
| closing.current = false | ||
| - const params = Platform.select({ | ||
| - android: [props], | ||
| - ios: [props, onConfirm, onCancel], | ||
| - }) | ||
| - if (!params) throw Error('Unsupported platform') | ||
| - NativeModule.openPicker(...params) | ||
| + NativeModule.openPicker(props, onConfirm, onCancel) | ||
| } | ||
| }, [onCancel, onConfirm, previousProps, props]) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is the patch described in this PR's description.