henninghall / react-native-date-picker

React Native Date Picker is datetime picker for Android and iOS. It includes date, time and datetime picker modes. The datepicker is customizable and is supporting different languages. It's written with native code to achieve the best possible look, feel and performance.
MIT License
2.26k stars 347 forks source link

Horizontal ScrollView Not Scrolling When Swiping Over DatePicker on Android #847

Open dayze opened 3 months ago

dayze commented 3 months ago

Describe the bug On Android, if a DatePicker is placed inside a horizontal ScrollView, swiping left or right over the DatePicker does not cause the ScrollView to scroll.

Expected behavior Like on iOS, on Android, when a DatePicker is placed inside a horizontal ScrollView, swiping left or right over the DatePicker should allow the ScrollView to scroll smoothly, while still enabling the DatePicker to function correctly.

To Reproduce Add example code that reproduces the behavior.

const width = Dimensions.get('window').width;
export const Component = () => {
  return (
    <ScrollView horizontal pagingEnabled>
      <View style={{ width }}>
        <DatePicker theme="light" mode="time" date={new Date()} />
      </View>
      <View style={{ width }}>
        <DatePicker theme="light" mode="time" date={new Date()} />
      </View>
    </ScrollView>
  );
};

Smartphone (please complete the following information):

henninghall commented 3 months ago

Does it work as expected a vertical ScrollView?

dayze commented 3 months ago

You will have to touch "outside" the DatePicker component to work in a vertical ScrollView.

To be more precise with the issue, using the following screenshoot : on iOS, all the blue zone can be used to "scroll" (left/right) on Android, in the red box, we can't use this zone to "scroll" (left/right)

I've attempted to use pointerEvents in the ScrollView, but on Android, either the DatePicker scrolling doesn't work or the swipe area is not correctly recognized.

Android Screenshot_20240813-133336_Combo_Staging iOS Simulator Screenshot - develop - 2024-08-13 at 13 31 49