Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flexWrap wrapping unexpectedly with alignItems: 'flex-end' #48527

Open
a-klotz-p8 opened this issue Jan 8, 2025 · 12 comments
Open

flexWrap wrapping unexpectedly with alignItems: 'flex-end' #48527

a-klotz-p8 opened this issue Jan 8, 2025 · 12 comments
Assignees
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Newer Patch Available

Comments

@a-klotz-p8
Copy link

Description

This bug/issue seems to be screen size dependent. In the provided example with the used text the incorrect wrapping is visible on the Pixel 7 screen. The same issue is also on ios, but there I did not test which text + device causes the too early overflow. When the text is changed (shortened or lengthened) the overflow disappears until the correct overflow occurs. Maybe this has something to do with the way the Views are nested, but I still don't understand how this is expected behaviour.

Pixel 7 the text wraps, but it should not yet and the backgroundColor is also only displayed on the top Text.

Bildschirmfoto 2025-01-08 um 11 27 57

Pixel 4 the same text does not wrap:

Bildschirmfoto 2025-01-08 um 11 26 01

Steps to reproduce

  1. Locally run the code provided in the expo snack using a pixel 7 simulator or test it directly in expo snack

React Native Version

0.76.1

Affected Platforms

Runtime - Android

Output of npx react-native info

System:
  OS: macOS 14.6
  CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Memory: 10.96 GB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.3.0
    path: /usr/local/bin/node
  Yarn: Not Found
  npm:
    version: 10.9.0
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.12.02.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2412.12266719
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.13
    path: /usr/bin/javac
  Ruby:
    version: 3.3.5
    path: /usr/local/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0
    wanted: 15.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.1
    wanted: ^0.76.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

No crash/failure occurs

Reproducer

https://snack.expo.dev/@alex_p8/gnarly-orange-ramen

Screenshots and Videos

Bildschirmfoto 2025-01-08 um 11 27 57
@react-native-bot
Copy link
Collaborator

Tip

Newer version available: You are on a supported minor version, but it looks like there's a newer patch available - 0.76.5. 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.

@react-native-bot
Copy link
Collaborator

Tip

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.

@a-klotz-p8 a-klotz-p8 reopened this Jan 9, 2025
@a-klotz-p8
Copy link
Author

Here is the code that causes the unexpected wrapping. flex-start and center also lead to the same early wrapping

import { Text, View } from 'react-native';

export default function App() {
  return (
      <View style={{ alignItems: 'flex-end' }}>
        <View>
          <View
            style={{
              flexDirection: 'row',
              flexWrap: 'wrap',
              gap: 16,
              backgroundColor: 'green',
            }}>
            <Text>Testi osa</Text>
            <Text>overflow</Text>
          </View>
        </View>
      </View>
  );
}

@cortinico
Copy link
Contributor

@NickGerleman do you have context on this one?

@krishpranav
Copy link

Hi, kindly share me further details so that will rise a PR for this issue.

@a-klotz-p8
Copy link
Author

Hi, kindly share me further details so that will rise a PR for this issue.

@krishpranav what additional details do you need?

@krishpranav
Copy link

does the above issue only happens on the pixel device or it is reproducing on other devices?

@a-klotz-p8
Copy link
Author

does the above issue only happens on the pixel device or it is reproducing on other devices?

AFAIK it can happen on any device. It seems to depend on the screen width and text. I have had it happen on iOS devices as well.

@krishpranav
Copy link

let me check it get back to you.

@krishpranav
Copy link

krishpranav commented Jan 9, 2025

Simulator Screenshot - iPhone 16 - 2025-01-09 at 20 10 53

iPhone 16 - latest react-native version.

@a-klotz-p8
Copy link
Author

a-klotz-p8 commented Jan 9, 2025

@krishpranav
can you try this on an iPhone 16 Pro (for me this leads to the overflow issue):

import { Text, View } from 'react-native';

export default function App() {
  return (
      <View style={{ alignItems: 'flex-start' }}>
        <View>
          <View
            style={{
              flexDirection: 'row',
              flexWrap: 'wrap',
              gap: 16,
              backgroundColor: 'green',
            }}>
            <Text>Teisdacnjd cddi osa</Text>
            <Text>overflos</Text>
          </View>
        </View>
      </View>
  );
}

see:
Bildschirmfoto 2025-01-09 um 15 46 52

@krishpranav
Copy link

krishpranav commented Jan 9, 2025

yes, I am able to reproduce the issue. working on this issue. @cortinico can you assign me this issue?

@cortinico cortinico added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. and removed Needs: Triage 🔍 labels Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Newer Patch Available
Projects
None yet
Development

No branches or pull requests

4 participants