mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 20:44:10 +00:00
Fix RCTText not always drawing in Nodes
Summary: In Nodes, there were certain cases where text wasn't drawn due to an optimization that skipped measuring because the size was already known. Reviewed By: emilsjolander Differential Revision: D3713841
This commit is contained in:
parent
8600723402
commit
bcf2e329ed
@ -133,10 +133,21 @@ import com.facebook.textcachewarmer.DefaultTextLayoutCacheWarmer;
|
|||||||
clipRight,
|
clipRight,
|
||||||
clipBottom);
|
clipBottom);
|
||||||
|
|
||||||
|
if (mText == null) {
|
||||||
|
// as an optimization, LayoutEngine may not call measure in certain cases, such as when the
|
||||||
|
// dimensions are already defined. in these cases, we should still draw the text.
|
||||||
|
if (bottom - top > 0 && right - left > 0) {
|
||||||
|
CharSequence text = getText();
|
||||||
|
if (!TextUtils.isEmpty(text)) {
|
||||||
|
mText = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mText == null) {
|
if (mText == null) {
|
||||||
// nothing to draw (empty text).
|
// nothing to draw (empty text).
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
boolean updateNodeRegion = false;
|
boolean updateNodeRegion = false;
|
||||||
if (mDrawCommand == null) {
|
if (mDrawCommand == null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user