react / react/react-native

onTextLayOut is not getting triggered

オープン
#37,902 コメント 11 件 リアクション 6 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Issue: Author Provided Repro
主要言語
C++
スター
127k
フォーク
25.3k
平均マージ
1日 23時間
マージ済み PR(30日)
4

説明

Description

For a text component , if we specify onTextLayout and write log statement, its not getting triggered.

i wanted to use the onTextLayout to get the no of lines being rendered for a given text width. The no of lines might change based on the width prop in style.

Therefor, i would like to get the no of lines to do some operation on text when it exceeds max lines limit.

React Native Version

0.70.2

Output of npx react-native info

N/A

Steps to reproduce

Write a text component and define "onTextLayout" prop to send in the handler.

The handler doesn't get triggered even during the first layout render.

Snack, code example, screenshot, or link to a repository

https://snack.expo.dev/Wff9zMnHx

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

リンクされた Snack の再現例と Text コンポーネントの onTextLayout の動作から始め、報告された React Native 0.70.2 の構成でハンドラーが発火するか確認します。ハンドラーがレイアウト中に発火し、テキスト幅が変化した場合も含めて、レンダリングされた行数を取得できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react-native
領域
mobile
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。