You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing a big discrepency between react native web and iOS/Android for the behavior of alignContent: stretch for views with flexWrap: wrap and flexDirection: column. I noticed the discrepency when I tried to set the alignSelf property of an individual element inside the flex container.
On web, alignContent: stretch works as expected. Each row becomes tall enough that I can align elements individually within their respective row using alignSelf
But on iOS and Android, alignSelfinitially seems to have no effect. This is because, even though alignContent: stretch is set, the implicit row containers don't actually stretch out to their full height. Rows begin in their expected positions, but the height of each row is implicitly fit to contents instead of stretching. This means my elements can't align themselves properly — they have nowhere to go, their container is too restricted.
An almost-workaround I found, for example, is to add an empty view inside the flex container that has the desired height of a row — that makes the row stretch out enough so that other elements are visibly aligned correctly. But this isn't a real option for me — first of all, it breaks any layout that depends on the number I can't guarantee the height or number of any particular element, as I need to build very generically.
Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.76.7. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - undefined. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.
Description
I'm seeing a big discrepency between react native web and iOS/Android for the behavior of
alignContent: stretch
for views withflexWrap: wrap
andflexDirection: column
. I noticed the discrepency when I tried to set thealignSelf
property of an individual element inside the flex container.On web,
alignContent: stretch
works as expected. Each row becomes tall enough that I can align elements individually within their respective row usingalignSelf
But on iOS and Android,
alignSelf
initially seems to have no effect. This is because, even thoughalignContent: stretch
is set, the implicit row containers don't actually stretch out to their full height. Rows begin in their expected positions, but the height of each row is implicitly fit to contents instead of stretching. This means my elements can't align themselves properly — they have nowhere to go, their container is too restricted.An almost-workaround I found, for example, is to add an empty view inside the flex container that has the desired height of a row — that makes the row stretch out enough so that other elements are visibly aligned correctly. But this isn't a real option for me — first of all, it breaks any layout that depends on the number I can't guarantee the height or number of any particular element, as I need to build very generically.
Steps to reproduce
See expo snack
In general, I believe:
"flexDirection": "row"
,"flexWrap": "wrap"
,"alignContent": "stretch"
"alignSelf": "flex-end",
or `"alignSelf": "center"alignSelf
changes the element's position on web, as expect, but has no effect on ios/androidReact Native Version
0.76.3
Affected Platforms
Runtime - iOS, Runtime - Android
Output of
npx @react-native-community/cli info
Stacktrace or Logs
Reproducer
https://snack.expo.dev/OT-sH48w22h3vDCqD6nra?platform=ios
Screenshots and Videos
Web (Expected Behavior)

Mobile (Rows are too short, can't align properly)

The text was updated successfully, but these errors were encountered: