react / react/react-native

Text with a View child does not correctly re-render when its text child changes

Open
#31,341 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Component: Text Issue: Author Provided Repro
Dominant language
C++
Stars
127k
Forks
25.3k
Avg merge
1d 23h
Merged PRs (30d)
4

Description

Description

Consider a Text element with the following children:

  1. 'some text'
  2. <View> // with certain dimensions
  3. 'some text'

When the first child changes content - triggering the render of Text component, the View is not repositioned accordingly.

React Native version:

0.64.0, 0.63.2
react version: 17.0.1

Steps To Reproduce

  1. Have a Text with the children as specified above
  2. Make the 1st element - text, change its content
  3. Observe the View did not get repositioned accordingly
  4. Repro on Android

Expected Results

The child Views get repositioned accordingly, if necessary, when the Text re-renders.

Screenshots

Initial render After the 1st child changes
image image

Snack

https://snack.expo.io/D-ZJ4cWeC

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 by running the linked Snack on Android with a Text containing two text children and a dimensioned View, then change the first text child. Trace the Android Text/View layout behavior responsible for positioning and verify that the View is repositioned after the text changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, react-native
Domain
mobile
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.