-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Implement scrollWidth/scrollHeight #39328
Conversation
This pull request was exported from Phabricator. Differential Revision: D49058368 |
Base commit: a63b443 |
This pull request was exported from Phabricator. Differential Revision: D49058368 |
Summary: Pull Request resolved: facebook#39328 This adds a new method in Fabric to get the scroll size for an element, and uses it to implement `scrollWidth` and `scrollHeight` as defined in react-native-community/discussions-and-proposals#607 Scroll size determine how much of the content of a node would move if the node was scrollable. If the content does not overflow the padding box of the node, then this is the same as the `client{Width,Height}` (the size of the node without its borders). If the content would overflow the node, then it would be the size of the content that would be scrollable (in other words, what would "move" when you scrolled). If the element isn't displayed or it has display: inline, it return 0 in both cases. These APIs provide rounded integers. NOTE: The current implementation of `ScrollView` has several known bugs and inconsistencies across platforms (Android vs. iOS) and architectures (Paper vs. Fabric) (e.g.: content showing on top of the border on Android, `overflow: visible` only working on Android but not on iOS, etc.). The data that this API reports is the one that aligns with the Web (with a few limitations), and we'll need to fix the implementation to align with this. NOTE: transforms are not considered correctly for the sake of this API, but also not applied correctly in any of the native platforms. On Web, the scrollable area is the overflow of all the children **with transforms applied** which isn't honored in RN. We''ll fix the data reported by this API when we also fix the user perceived behavior. Changelog: [internal] Differential Revision: D49058368 fbshipit-source-id: 9b8cbc0810820655f1dd510ca7bdb212516e3610
6cd5a71
to
aa77889
Compare
This pull request was exported from Phabricator. Differential Revision: D49058368 |
Summary: Pull Request resolved: facebook#39328 This adds a new method in Fabric to get the scroll size for an element, and uses it to implement `scrollWidth` and `scrollHeight` as defined in react-native-community/discussions-and-proposals#607 Scroll size determine how much of the content of a node would move if the node was scrollable. If the content does not overflow the padding box of the node, then this is the same as the `client{Width,Height}` (the size of the node without its borders). If the content would overflow the node, then it would be the size of the content that would be scrollable (in other words, what would "move" when you scrolled). If the element isn't displayed or it has display: inline, it return 0 in both cases. These APIs provide rounded integers. NOTE: The current implementation of `ScrollView` has several known bugs and inconsistencies across platforms (Android vs. iOS) and architectures (Paper vs. Fabric) (e.g.: content showing on top of the border on Android, `overflow: visible` only working on Android but not on iOS, etc.). The data that this API reports is the one that aligns with the Web (with a few limitations), and we'll need to fix the implementation to align with this. NOTE: transforms are not considered correctly for the sake of this API, but also not applied correctly in any of the native platforms. On Web, the scrollable area is the overflow of all the children **with transforms applied** which isn't honored in RN. We''ll fix the data reported by this API when we also fix the user perceived behavior. Changelog: [internal] Reviewed By: sammy-SC Differential Revision: D49058368 fbshipit-source-id: 1b3652f24c0aba4e9d47cd0e96fbad4a18729b2f
aa77889
to
c819212
Compare
This pull request was exported from Phabricator. Differential Revision: D49058368 |
Summary: Pull Request resolved: facebook#39328 This adds a new method in Fabric to get the scroll size for an element, and uses it to implement `scrollWidth` and `scrollHeight` as defined in react-native-community/discussions-and-proposals#607 Scroll size determine how much of the content of a node would move if the node was scrollable. If the content does not overflow the padding box of the node, then this is the same as the `client{Width,Height}` (the size of the node without its borders). If the content would overflow the node, then it would be the size of the content that would be scrollable (in other words, what would "move" when you scrolled). If the element isn't displayed or it has display: inline, it return 0 in both cases. These APIs provide rounded integers. NOTE: The current implementation of `ScrollView` has several known bugs and inconsistencies across platforms (Android vs. iOS) and architectures (Paper vs. Fabric) (e.g.: content showing on top of the border on Android, `overflow: visible` only working on Android but not on iOS, etc.). The data that this API reports is the one that aligns with the Web (with a few limitations), and we'll need to fix the implementation to align with this. NOTE: transforms are not considered correctly for the sake of this API, but also not applied correctly in any of the native platforms. On Web, the scrollable area is the overflow of all the children **with transforms applied** which isn't honored in RN. We''ll fix the data reported by this API when we also fix the user perceived behavior. Changelog: [internal] Reviewed By: sammy-SC Differential Revision: D49058368 fbshipit-source-id: 03f1875e66dbdaafb51291888f5fdf551692543e
c819212
to
909559a
Compare
Differential Revision: D49020219 fbshipit-source-id: 46e987cc5cd21648f48973d9433afea9b0da7b49
Summary: Pull Request resolved: facebook#39328 This adds a new method in Fabric to get the scroll size for an element, and uses it to implement `scrollWidth` and `scrollHeight` as defined in react-native-community/discussions-and-proposals#607 Scroll size determine how much of the content of a node would move if the node was scrollable. If the content does not overflow the padding box of the node, then this is the same as the `client{Width,Height}` (the size of the node without its borders). If the content would overflow the node, then it would be the size of the content that would be scrollable (in other words, what would "move" when you scrolled). If the element isn't displayed or it has display: inline, it return 0 in both cases. These APIs provide rounded integers. NOTE: The current implementation of `ScrollView` has several known bugs and inconsistencies across platforms (Android vs. iOS) and architectures (Paper vs. Fabric) (e.g.: content showing on top of the border on Android, `overflow: visible` only working on Android but not on iOS, etc.). The data that this API reports is the one that aligns with the Web (with a few limitations), and we'll need to fix the implementation to align with this. NOTE: transforms are not considered correctly for the sake of this API, but also not applied correctly in any of the native platforms. On Web, the scrollable area is the overflow of all the children **with transforms applied** which isn't honored in RN. We''ll fix the data reported by this API when we also fix the user perceived behavior. Changelog: [internal] Reviewed By: sammy-SC Differential Revision: D49058368 fbshipit-source-id: b97ad4e60e4385cdd75c3092d8eb7df685e16afc
This pull request was exported from Phabricator. Differential Revision: D49058368 |
909559a
to
40c37e0
Compare
This pull request has been merged in f275603. |
Summary:
This adds a new method in Fabric to get the scroll size for an element, and uses it to implement
scrollWidth
andscrollHeight
as defined in react-native-community/discussions-and-proposals#607Scroll size determine how much of the content of a node would move if the node was scrollable. If the content does not overflow the padding box of the node, then this is the same as the
client{Width,Height}
(the size of the node without its borders). If the content would overflow the node, then it would be the size of the content that would be scrollable (in other words, what would "move" when you scrolled).If the element isn't displayed or it has display: inline, it return 0 in both cases.
These APIs provide rounded integers.
Changelog: [internal]
Differential Revision: D49058368