Skip to content
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

Calendar.List on BottomSheetModal - React Native Web #30

Closed
ddikodroid opened this issue Apr 18, 2024 · 2 comments
Closed

Calendar.List on BottomSheetModal - React Native Web #30

ddikodroid opened this issue Apr 18, 2024 · 2 comments

Comments

@ddikodroid
Copy link

First, thank you for making this library. I once create a date range picker component that working perfectly on both iOS and Android.

But, when I open it in the web, the calendar is just a blank white like this.
Screenshot 2024-04-18 at 16 03 21

I don't have any clue what's wrong with my code. Maybe you can give me some insight.

Source code

const DateRangePicker = ({
  label,
  dateRange,
  onClearDateRange,
  onCalendarDayPress,
  calendarActiveDateRanges,
  containerStyle,
}: {
  label: string;
  dateRange: any;
  onClearDateRange: () => void;
  onCalendarDayPress: (date: any) => void;
  calendarActiveDateRanges: CalendarActiveDateRange[];
  containerStyle: ViewStyle;
}) => {
  const bottomSheetRef = useRef<BottomSheetModal>(null);
  const snapPoints = useMemo(() => ['75%', '90%'], []);

  const renderBackdrop = (props: BottomSheetBackdropProps) => (
    <BottomSheetBackdrop {...props} />
  );

  return (
    <View style={containerStyle}>
      <Text style={globalStyles.textInputLabel}>{label}</Text>
      <Pressable
        style={{ width: '100%' }}
        onPress={() => {
          bottomSheetRef.current?.present();
        }}>
        <View style={styles.textInputContainer}>
          <TextInput
            editable={false}
            //outlineStyle is working on web, but not detected on mobile
            // @ts-ignore:next-line
            style={[styles.textInput, isWeb ? { outlineStyle: 'none' } : {}]}
            value={getDateRange(dateRange)}
          />
          <Image
            source={require('@/assets/icons/calendar-days.png')}
            style={{ width: 26, height: 26 }}
            resizeMode='contain'
          />
        </View>
      </Pressable>
      <BottomSheetModal
        index={1}
        ref={bottomSheetRef}
        snapPoints={snapPoints}
        backdropComponent={renderBackdrop}>
        <Calendar.List
          calendarFormatLocale='id-ID'
          onCalendarDayPress={onCalendarDayPress}
          calendarActiveDateRanges={calendarActiveDateRanges}
        />
      </BottomSheetModal>
    </View>
  );
};

export default DateRangePicker;
@bpingris
Copy link
Contributor

by any chance is your browser colorscheme set to dark? could you try to change it to light if that's the case?
if it is this PR should fix it

@ddikodroid
Copy link
Author

by any chance is your browser colorscheme set to dark? could you try to change it to light if that's the case?
if it is this PR should fix it

thank you for the response

yes, my browser is in dark mode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants