Closed Mookiies closed 5 months ago
:warning: | Newer Version of React Native is Available! |
---|---|
:information_source: | You are on a supported minor version, but it looks like there's a newer patch available - 0.73.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. |
This issue is present on latest patch
I think this is no longer and issue on react-native 0.74.0
@Mookiies is this something that no longer reproes in RN 0.74/Expo 51, or just doesn’t repro in latest Yoga playground?
RN is opted into some older code wrt absolute positioning, so it’s possible they have different behavior.
It looks to be solved on RN 0.74.
I tried it out here and doesn't seem to happen anymore: https://github.com/Mookiies/absolute-repro/tree/master
Description
If using
gap
,justifyContent
, and the first child is absolutely positioned, other children will be offset by thegap
value.This is unexpected because, the parent view should be containing the children, but it's not. Absolutely positioned children should not affect
gap
or the positioning of other views. Current behavior doesn't match CSS.Somewhat related to https://github.com/facebook/yoga/issues/1652
Steps to reproduce
gap
and a non-defaultjustifyContent
position: 'absolute
on the first childReact Native Version
0.73.7
Affected Platforms
Runtime - Android, Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://snack.expo.dev/@mookiies/gap-moving-child
Screenshots and Videos
Container has blue background and
gap
value of100
Pink square is first childposition: 'absolute
with dimensions 50x50 Red square is second child with dimensions 100x100justifyContent: 'center'
gap/2
justifyContent: 'flex-end'
justifyContent: 'flex-start'
Same behavior of gap affecting children persists with multiple children (2 children red squares)
justifyContent: 'center'
gap/2
justifyContent: 'flex-start'
Reproduction with web react: https://playcode.io/1850576