Description
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, alignSelf initially 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.
Steps to reproduce
See expo snack
In general, I believe:
- Create a flex container with
"flexDirection": "row", "flexWrap": "wrap", "alignContent": "stretch"
- Add a child with
"alignSelf": "flex-end", or `"alignSelf": "center"
- Observe that
alignSelf changes the element's position on web, as expect, but has no effect on ios/android
React Native Version
0.76.3
Affected Platforms
Runtime - iOS, Runtime - Android
Output of npx @react-native-community/cli info
System:
OS: macOS 14.7.1
CPU: (8) arm64 Apple M2
Memory: 154.44 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 22.14.0
path: ~/.nvm/versions/node/v22.14.0/bin/node
Yarn: Not Found
npm:
version: 10.9.2
path: ~/.nvm/versions/node/v22.14.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/lib/ruby/gems/3.3.0/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.1
- iOS 18.1
- macOS 15.1
- tvOS 18.1
- visionOS 2.1
- watchOS 11.1
Android SDK:
API Levels:
- "34"
- "35"
Build Tools:
- 33.0.1
- 34.0.0
- 35.0.0
System Images:
- android-35 | ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12700392
Xcode:
version: 16.1/16B40
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.13
path: /usr/bin/javac
Ruby:
version: 3.3.6
path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.76.6
wanted: 0.76.6
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
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)

Description
I'm seeing a big discrepency between react native web and iOS/Android for the behavior of
alignContent: stretchfor views withflexWrap: wrapandflexDirection: column. I noticed the discrepency when I tried to set thealignSelfproperty of an individual element inside the flex container.On web,
alignContent: stretchworks as expected. Each row becomes tall enough that I can align elements individually within their respective row usingalignSelfBut on iOS and Android,
alignSelfinitially seems to have no effect. This is because, even thoughalignContent: stretchis 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"alignSelfchanges 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 infoStacktrace 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)
