-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Enable window/body based scrolling for all ScrollViews #1472
base: master
Are you sure you want to change the base?
Conversation
The idea is to wrap the whole app in a (Hacky tip for people who want to use nested Flatlists: use A Flatlist without data and put everything in the |
I’m playing with I'm facing some issues related to the fact that the web is designed to have the Here are some of the issues I'm facing without this PR because of the previously stated problem:
I haven't looked into this PR code but I think the general idea of an |
@MathieuUrstein Did you test the code of the PR or of the general React Native Web version. If you used Expo Snack you unfortunately cannot test this PR (as far as I know).
This PR tries to solve exactly that. It disables the default scroll behaviour of the Did you use the exact Snack, because this neither uses my PR nor the I think that designing for body scrolling will always have some caveats, but is generally an improvement. Body scrolling is not something that people would use who just want to put their mobile app on the web with whatever means but instead tailors to people who want to build a proper web app. |
68432e1
to
4c6d6fe
Compare
4c6d6fe
to
17c2225
Compare
@necolas I rebased the PR on the current master with the new and fancy storybook. |
No I was demonstrating some issues we currently have with react-native-web that your PR can solve. My comment was targeted to prove that your PR is a great idea :) P:S: I have edited my previous comment to clarify my point. |
This comment has been minimized.
This comment has been minimized.
What about working this feature as a external component? A drop-in replacement for the native ScrollView... |
@piranna My changes are mostly in ScrollViewBase.js. I don't see an easy way to avoid duplicating the whole code and reexporting every ScrollView (incl. FlatList, ListView, ...). This would be a way better fit. |
This is a valid solution for me... |
That sounds like a fantastic feature, thanks! Any way to help? @EyMaddis - do you have any example to share to test your proposal? |
I am actually really interested in this. What is the status of this, does this work with the new responder system? |
Before I invest any more time into supporting this, I would like to know whether this has a chance of getting merged at all. Could you comment on that, @necolas? |
looking forward to this feature |
I don't think this is necessary anymore in the new version of |
@jfrolich do you mean AppRegistery on |
I am always impressed by this project and today is finally the day to give a little bit back! 😃
This PR is the first version of using the full page scrolling with React Native Web apps.
In the past, people could only use
<ScrollViews />
with fixed heights wrapped around the full page.This has multiple restrictions, for example it blocks mobile browsers (both Chrome on Android and iOS) from hiding the navigation bars if the page is scrolled down, blocking a lot of the screen. Generally, this leads to the pages feeling less like proper websites.
My proposed solution allows for any ScrollView component to use a new prop
useWindowScrolling={true}
to let itself grow freely and use the scroll events ofdocument.body
. This also works forVirtualizedList
s (includingFlatList
).I added a
<FlatList Window Scroll>
example to show its functionality.I am sure that there are more issues to tackle. For example I am unsure wether scroll positions should be normalized such that the position of the
<ScrollView />
on the page is used to subtract from the scroll positionx
/y
values.