mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-15 23:03:58 +08:00
Refactor types used during yoga meassure calls
Summary: This diff refactors the types used when Yoga requires to measure the size of a View in C++ Reviewed By: shergin Differential Revision: D13124086 fbshipit-source-id: 89dfe80bb41b4fb2eaba84af630d52ef2509b1e1
This commit is contained in:
committed by
Facebook Github Bot
parent
0357d0de64
commit
10ce6c3e11
@@ -213,7 +213,7 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
return null;
|
||||
}
|
||||
|
||||
public float[] measure(
|
||||
public long measure(
|
||||
ReactContext context,
|
||||
T view,
|
||||
ReadableNativeMap localData,
|
||||
@@ -222,6 +222,6 @@ public abstract class ViewManager<T extends View, C extends ReactShadowNode>
|
||||
YogaMeasureMode widthMode,
|
||||
float height,
|
||||
YogaMeasureMode heightMode) {
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ReactTextViewManager
|
||||
return MapBuilder.of("topTextLayout", MapBuilder.of("registrationName", "onTextLayout"));
|
||||
}
|
||||
|
||||
public float[] measure(
|
||||
public long measure(
|
||||
ReactContext context,
|
||||
ReactTextView view,
|
||||
ReadableNativeMap localData,
|
||||
|
||||
@@ -32,6 +32,7 @@ import com.facebook.react.uimanager.ReactStylesDiffMap;
|
||||
import com.facebook.react.uimanager.ViewDefaults;
|
||||
import com.facebook.yoga.YogaConstants;
|
||||
import com.facebook.yoga.YogaMeasureMode;
|
||||
import com.facebook.yoga.YogaMeasureOutput;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -189,7 +190,7 @@ public class TextLayoutManager {
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static float[] measureText(
|
||||
public static long measureText(
|
||||
ReactContext context,
|
||||
ReactTextView view,
|
||||
ReadableNativeMap attributedString,
|
||||
@@ -296,7 +297,7 @@ public class TextLayoutManager {
|
||||
height = layout.getHeight();
|
||||
}
|
||||
|
||||
return new float[] { PixelUtil.toSPFromPixel(width), PixelUtil.toSPFromPixel(height) };
|
||||
return YogaMeasureOutput.make(PixelUtil.toSPFromPixel(width), PixelUtil.toSPFromPixel(height));
|
||||
}
|
||||
|
||||
private static class SetSpanOperation {
|
||||
|
||||
Reference in New Issue
Block a user