Closed latekvo closed 3 months ago
Other available solutions include:
StyleSheet.absoluteFill, { position: 'relative' }
StyleSheet.absoluteFillObject, { position: 'relative' }
{ width: 'auto', height: 'auto' }
{ width: 'auto' }
I think StyleSheet.absoluteFill, { position: 'relative' }
is the most promising one but I'll have to look into it.
update: Could not find a difference between any of the listed styles. Additionally tested:
StyleSheet.absoluteFill, { position: 'relative', width: 'auto' }
StyleSheet.absoluteFill, { position: 'relative', width: '100%' }
and most other possible combinations of these styles.
As of f3f590a I updated the description to include nested flexbox example.
Technically { height: '100%' }
would suffice instead of the current { width: '100%', height: '100%' }
based solely on the tests that I did, but I am not fully confident I understand the underlaying mechanics of why that is, which is why I would prefer to leave it as { width: '100%', height: '100%' }
.
Please let me know WDYT @j-piasecki
Whether width
or height
alone would suffice is likely dependant on the layout direction - with flexDirection: 'column'
height will be enough and with flexDirection: 'row'
width will be enough.
Using both is probably best.
Description
When
Pressable
does not have it's dimensions robustly set, it should infer them from it's children, tofit-content
. Unfortunately that's not what happens.This PR fixes this issue.
Test plan
EmptyExample
Pressables
are identicalResults
Code