🐞 bug report
Affected Package
The issue is caused by package `rax-view`
Is this a regression?
No
🔬 Minimal Reproduction
Simplified page structure:
// import
import View from 'rax-view';
import Text from 'rax-text';
import ScrollView from 'rax-scrollview';
// render
<View style={{ maxHeight: "40vh" }}> {/* outer container */}
<View style={{ flex: 1 }}> {/* content container */}
{/* some other views: image, text, etc. */}
<ScrollView>
<Text>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Mattis rhoncus urna neque viverra justo nec ultrices dui sapien. Vestibulum lorem sed risus ultricies tristique nulla aliquet enim. In hac habitasse platea dictumst quisque sagittis purus sit amet. Pulvinar sapien et ligula ullamcorper. Rutrum tellus pellentesque eu tincidunt. Sed euismod nisi porta lorem mollis aliquam ut porttitor. At elementum eu facilisis sed odio morbi quis commodo. Nisi lacus sed viverra tellus in hac habitasse. Blandit cursus risus at ultrices mi tempus imperdiet nulla malesuada. Nunc sed velit dignissim sodales ut. Fermentum odio eu feugiat pretium nibh ipsum consequat. Ridiculus mus mauris vitae ultricies leo integer malesuada nunc vel. Tempor orci eu lobortis elementum nibh tellus molestie. Quis auctor elit sed vulputate mi. Orci sagittis eu volutpat odio facilisis mauris. Ultrices in iaculis nunc sed. Diam donec adipiscing tristique risus nec feugiat in.</Text> {/* very long text to make sure the ScrollView could scroll */}
</ScrollView>
</View>
{/* some other views -- e.g. a container view containing some buttons */}
</View>
Description
As the example shows above, the outer container
has a maxHeight: 40vh
style ('40vh' here is just for simplicity -- it might be other value in production environment -- but this doesn't affect the conclusion).
It also has a content container
and some other views (e.g. a container view containing some buttons) as child views.
The content container
view has the flex: 1
style to fill the outer container
. It might have some other child views(image, text, etc.), but our leading role in this example is a ScrollView
with very long text (so that we can "scroll").
Expected Correct Behavior
The very long text should NOT go beyond the outer container's bounds and we can scroll the ScrollView
.
Current Bug Behavior
The very long text goes beyond the outer container's bounds and we can't scroll the ScrollView
.
🌍 Your Environment
Rax Version:
dependencies:
{
"rax": "^1.1.0",
"rax-document": "^0.1.0",
"rax-image": "^2.0.0",
"rax-link": "^1.0.1",
"rax-scrollview": "^3.3.4",
"rax-text": "^2.0.0",
"rax-view": "^2.0.0"
}
devDependencies:
{
"@iceworks/spec": "^1.0.0",
"rax-app": "^3.0.0",
"eslint": "^6.8.0",
"prettier": "^2.1.2",
"stylelint": "^13.7.2"
}
Anything else relevant?
macOS:
bug behavior appears on Google Chrome (v87.0.4280.88)
correct behavior appears on Safari (14.0 (15610.1.28.1.9, 15610))
Solution (or Workaround)
After a long time comparing with react native web
, I found this commit.
That is, add a minHeight: 0
style entry in the content container
style, so it would be style={{ flex: 1, minHeight: 0 }}
now, and it really works!
Suggestion
Could we add 'min-height: 0;' in the file rax-components/packages/rax-view/src/index.css
(since there's a 'min-width: 0;' already in that css file) ?