react / react/yoga

Web Inconsistency: In some cases, text is unexpectedly collapsed

Open
#470 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Algorithm
Dominant language
C++
Stars
18.9k
Forks
1.6k
Avg merge
1m
Merged PRs (30d)
1

Description

As shown below, I have a couple of lines of text placed within some nodes which set flexGrow/flexShrink. One of the lines is unexpectedly invisible. Sorry I don't have a better description of the problem.

Here's a relatively small repro case I extracted from my team's app expressed using React Native components (there's a JSFiddle later):

<View style={{"position":"absolute","left":0,"right":0,"top":0,"bottom":0}}>
  <View style={{"alignSelf":"flex-start"}}>
    <View style={{"flexShrink":1}}>
      <Text>
        Top Text
      </Text>
    </View>
    <View>
      <View style={{"flexGrow":1}}>
        <Text>
          Bottom Text
        </Text>
      </View>
    </View>
  </View>
</View>
Expected Result

Both "Top Text" and "Bottom Text" are visible (JSFiddle: https://jsfiddle.net/pygpx2oq/):

image

Actual Result

Only "Bottom Text" is visible:

image

Reproed using a version of React Native (https://github.com/facebook/react-native/commit/4c7576e485973391d4042e694523dbfe70e49b50) which appears to be using a version of Yoga from today (March 8).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the React Native component repro and the linked JSFiddle, then trace how Yoga handles the nested flexGrow and flexShrink nodes. Compare the rendered result with the expected image and add a regression case showing that both text lines remain visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, react-native
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.