Skip to content

Commit a331bb7

Browse files
committed
[RFC] Add ScrollView bounded height explanation
Summary: As discussed in our internal group, think this is a fairly easy error to run into so I added some explanation. @frantic / @vjeux open to better wording here, but I tried to explain how setting the height directly is discouraged and it's probably better to pipe `flex: 1` all the way down. I didn't regenerate the website since the script assumes some permissions (push permission to master repo) and has some missing npm dependencies (and after fixing that, still had some obscure error :P ) Closes #1633 Github Author: Peter Cottle <[email protected]> Test Plan: Imported from GitHub, without a `Test Plan:` line.
1 parent 477360b commit a331bb7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Libraries/Components/ScrollView/ScrollView.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ var INNERVIEW = 'InnerScrollView';
4242
* Component that wraps platform ScrollView while providing
4343
* integration with touch locking "responder" system.
4444
*
45+
* Keep in mind that ScrollViews must have a bounded height in order to work,
46+
* since they contain unbounded-height children into a bounded container (via
47+
* a scroll interaction). In order to bound the height of a ScrollView, either
48+
* set the height of the view directly (discouraged) or make sure all parent
49+
* views have bounded height. Forgetting to transfer `{flex: 1}` down the
50+
* view stack can lead to errors here, which the element inspector makes
51+
* easy to debug.
52+
*
4553
* Doesn't yet support other contained responders from blocking this scroll
4654
* view from becoming the responder.
4755
*/

0 commit comments

Comments
 (0)