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

Cannot Nest In ScrollView #23

Closed
ReneeGrantMA opened this issue Mar 13, 2024 · 3 comments
Closed

Cannot Nest In ScrollView #23

ReneeGrantMA opened this issue Mar 13, 2024 · 3 comments

Comments

@ReneeGrantMA
Copy link

I need to be able to nest the TimePicker within a ScrollView, however because this uses a Flatlist I get this Error:

VirtualizedLists should never be nested inside plain ScrollViews with the same orientation because it can break windowing and other functionality - use another VirtualizedList-backed container instead.

Example:
<ScrollView style={styles.content} nestedScrollEnabled={true}> <TimerPicker padWithNItems={2} hourLabel="hour" minuteLabel="min" hideSeconds LinearGradient={LinearGradient} onDurationChange={duration => setTime({ hour: duration.hours, minute: duration.minutes }) } styles={{ theme: 'light', backgroundColor: BrandColor.Beige, position: 'fixed', top: 0, pickerItem: { fontSize: 18, color: tinycolor(StandardColor.Charcoal) .lighten(20) .toRgbString(), }, pickerLabel: { fontSize: 20, right: -20, marginBottom: 4, fontWeight: 'normal', color: StandardColor.Charcoal, }, pickerLabelContainer: { width: 60, }, pickerItemContainer: { width: 150, height: 35, }, }} /> </ScrollView>

@troberts-28
Copy link
Owner

Hey @ReneeGrantMA 👋

I'll take a look at this. I had never tried nesting it inside a ScrollView.

Does your app actually crash or show abnormal behaviour when you do nest it in the ScrollView? That is a very common React Native warning that appears whenever you nest a ScrollView in another, and the picker uses ScrollViews to allow you to scroll between the numbers and pick values.

troberts-28 added a commit that referenced this issue May 6, 2024
@troberts-28
Copy link
Owner

@ReneeGrantMA Closing this as I can't see a clear path to support nesting the TimerPicker component in a vertical ScrollView. For your scenario, I'd suggest using the modal instead, which works fine regardless of the container.

I've acknowledged this limitation in the docs 👍

@troberts-28
Copy link
Owner

Hey @ReneeGrantMA, just letting you know that I figured out a way of making the TimerPicker component work in a vertical ScrollView in the latest version v1.9.0. You'll still get the warning from React Native, but the picker should now scroll.

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