Repository navigation
Conversation
|
@pentiumao has exported this pull request. If you are a Meta employee, you can view the originating Diff in D125292521. |
pentiumao
added a commit
to pentiumao/react-native
that referenced
this pull request
Oct 20, 2026
…59235) Summary: Pull Request resolved: react#59235 X-link: react/yoga#2046 X-link: facebook/litho#1093 **In one sentence.** A Java `YogaNode` with a measure function can now select Yoga's default pixel rounding, through a new `setNodeType` and its JNI binding to Yoga's existing `YGNodeSetNodeType`. ## Why this is needed Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (`YGNodeSetNodeType`); the Java binding could not. - Measured: of three nodes flexed to a third of a 100 wide row each, the first, given a measure function, ends at 33.33 and comes out 34 wide; without one, 33. ## What this diff does **`YogaNode.setNodeType(nodeType)`,** a new public open method that does nothing by default, so a `YogaNode` subclass built against an earlier class does not fail with `AbstractMethodError`. `YogaNodeJNIBase` overrides it through a new native method, `YogaNative.jni_YGNodeSetNodeTypeJNI`, which `YGJNIVanilla.cpp` registers and implements with `YGNodeSetNodeType`. `setMeasureFunction` still sets the type (text for a function, default for null), so a caller selects the type after it. ## What a Yoga user sees **A new public Yoga API.** **The Java and native halves must ship together.** `registerNatives` is strict: a Java class declaring `jni_YGNodeSetNodeTypeJNI` with a native library that lacks it, or the reverse, fails when the class registers. Changelog: [Android][Added] - Add `YogaNode.setNodeType` to select pixel rounding for measured nodes Reviewed By: christophpurrer Differential Revision: D125292521
pentiumao
force-pushed
the
export-D125292521
branch
from
October 20, 2026 16:17
dbe2490 to
880963f
Compare
pentiumao
added a commit
to pentiumao/yoga
that referenced
this pull request
Oct 20, 2026
…2046) Summary: X-link: react/react-native#59235 X-link: facebook/litho#1093 **In one sentence.** A Java `YogaNode` with a measure function can now select Yoga's default pixel rounding, through a new `setNodeType` and its JNI binding to Yoga's existing `YGNodeSetNodeType`. ## Why this is needed Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (`YGNodeSetNodeType`); the Java binding could not. - Measured: of three nodes flexed to a third of a 100 wide row each, the first, given a measure function, ends at 33.33 and comes out 34 wide; without one, 33. ## What this diff does **`YogaNode.setNodeType(nodeType)`,** a new public open method that does nothing by default, so a `YogaNode` subclass built against an earlier class does not fail with `AbstractMethodError`. `YogaNodeJNIBase` overrides it through a new native method, `YogaNative.jni_YGNodeSetNodeTypeJNI`, which `YGJNIVanilla.cpp` registers and implements with `YGNodeSetNodeType`. `setMeasureFunction` still sets the type (text for a function, default for null), so a caller selects the type after it. ## What a Yoga user sees **A new public Yoga API.** **The Java and native halves must ship together.** `registerNatives` is strict: a Java class declaring `jni_YGNodeSetNodeTypeJNI` with a native library that lacks it, or the reverse, fails when the class registers. Changelog: [Android][Added] - Add `YogaNode.setNodeType` to select pixel rounding for measured nodes Reviewed By: christophpurrer Differential Revision: D125292521
This was referenced Oct 20, 2026
pentiumao
added a commit
to pentiumao/litho
that referenced
this pull request
Oct 20, 2026
…ok#1093) Summary: X-link: react/react-native#59235 X-link: react/yoga#2046 **In one sentence.** A Java `YogaNode` with a measure function can now select Yoga's default pixel rounding, through a new `setNodeType` and its JNI binding to Yoga's existing `YGNodeSetNodeType`. ## Why this is needed Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (`YGNodeSetNodeType`); the Java binding could not. - Measured: of three nodes flexed to a third of a 100 wide row each, the first, given a measure function, ends at 33.33 and comes out 34 wide; without one, 33. ## What this diff does **`YogaNode.setNodeType(nodeType)`,** a new public open method that does nothing by default, so a `YogaNode` subclass built against an earlier class does not fail with `AbstractMethodError`. `YogaNodeJNIBase` overrides it through a new native method, `YogaNative.jni_YGNodeSetNodeTypeJNI`, which `YGJNIVanilla.cpp` registers and implements with `YGNodeSetNodeType`. `setMeasureFunction` still sets the type (text for a function, default for null), so a caller selects the type after it. ## What a Yoga user sees **A new public Yoga API.** **The Java and native halves must ship together.** `registerNatives` is strict: a Java class declaring `jni_YGNodeSetNodeTypeJNI` with a native library that lacks it, or the reverse, fails when the class registers. Changelog: [Android][Added] - Add `YogaNode.setNodeType` to select pixel rounding for measured nodes Reviewed By: christophpurrer Differential Revision: D125292521
pentiumao
added a commit
to pentiumao/react-native
that referenced
this pull request
Oct 20, 2026
…59235) Summary: Pull Request resolved: react#59235 X-link: react/yoga#2046 X-link: facebook/litho#1093 **In one sentence.** A Java `YogaNode` with a measure function can now select Yoga's default pixel rounding, through a new `setNodeType` and its JNI binding to Yoga's existing `YGNodeSetNodeType`. ## Why this is needed Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (`YGNodeSetNodeType`); the Java binding could not. - Measured: of three nodes flexed to a third of a 100 wide row each, the first, given a measure function, ends at 33.33 and comes out 34 wide; without one, 33. ## What this diff does **`YogaNode.setNodeType(nodeType)`,** a new public open method that does nothing by default, so a `YogaNode` subclass built against an earlier class does not fail with `AbstractMethodError`. `YogaNodeJNIBase` overrides it through a new native method, `YogaNative.jni_YGNodeSetNodeTypeJNI`, which `YGJNIVanilla.cpp` registers and implements with `YGNodeSetNodeType`. `setMeasureFunction` still sets the type (text for a function, default for null), so a caller selects the type after it. ## What a Yoga user sees **A new public Yoga API.** **The Java and native halves must ship together.** `registerNatives` is strict: a Java class declaring `jni_YGNodeSetNodeTypeJNI` with a native library that lacks it, or the reverse, fails when the class registers. Changelog: [Android][Added] - Add `YogaNode.setNodeType` to select pixel rounding for measured nodes Reviewed By: christophpurrer Differential Revision: D125292521
pentiumao
force-pushed
the
export-D125292521
branch
from
October 20, 2026 16:30
880963f to
e3b71b5
Compare
pentiumao
added a commit
to pentiumao/yoga
that referenced
this pull request
Oct 20, 2026
…2046) Summary: X-link: react/react-native#59235 Pull Request resolved: react#2046 X-link: facebook/litho#1093 **In one sentence.** A Java `YogaNode` with a measure function can now select Yoga's default pixel rounding, through a new `setNodeType` and its JNI binding to Yoga's existing `YGNodeSetNodeType`. ## Why this is needed Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (`YGNodeSetNodeType`); the Java binding could not. - Measured: of three nodes flexed to a third of a 100 wide row each, the first, given a measure function, ends at 33.33 and comes out 34 wide; without one, 33. ## What this diff does **`YogaNode.setNodeType(nodeType)`,** a new public open method that does nothing by default, so a `YogaNode` subclass built against an earlier class does not fail with `AbstractMethodError`. `YogaNodeJNIBase` overrides it through a new native method, `YogaNative.jni_YGNodeSetNodeTypeJNI`, which `YGJNIVanilla.cpp` registers and implements with `YGNodeSetNodeType`. `setMeasureFunction` still sets the type (text for a function, default for null), so a caller selects the type after it. ## What a Yoga user sees **A new public Yoga API.** **The Java and native halves must ship together.** `registerNatives` is strict: a Java class declaring `jni_YGNodeSetNodeTypeJNI` with a native library that lacks it, or the reverse, fails when the class registers. Changelog: [Android][Added] - Add `YogaNode.setNodeType` to select pixel rounding for measured nodes Reviewed By: christophpurrer Differential Revision: D125292521
pentiumao
added a commit
to pentiumao/litho
that referenced
this pull request
Oct 20, 2026
…ok#1093) Summary: X-link: react/react-native#59235 X-link: react/yoga#2046 Pull Request resolved: facebook#1093 **In one sentence.** A Java `YogaNode` with a measure function can now select Yoga's default pixel rounding, through a new `setNodeType` and its JNI binding to Yoga's existing `YGNodeSetNodeType`. ## Why this is needed Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (`YGNodeSetNodeType`); the Java binding could not. - Measured: of three nodes flexed to a third of a 100 wide row each, the first, given a measure function, ends at 33.33 and comes out 34 wide; without one, 33. ## What this diff does **`YogaNode.setNodeType(nodeType)`,** a new public open method that does nothing by default, so a `YogaNode` subclass built against an earlier class does not fail with `AbstractMethodError`. `YogaNodeJNIBase` overrides it through a new native method, `YogaNative.jni_YGNodeSetNodeTypeJNI`, which `YGJNIVanilla.cpp` registers and implements with `YGNodeSetNodeType`. `setMeasureFunction` still sets the type (text for a function, default for null), so a caller selects the type after it. ## What a Yoga user sees **A new public Yoga API.** **The Java and native halves must ship together.** `registerNatives` is strict: a Java class declaring `jni_YGNodeSetNodeTypeJNI` with a native library that lacks it, or the reverse, fails when the class registers. Changelog: [Android][Added] - Add `YogaNode.setNodeType` to select pixel rounding for measured nodes Reviewed By: christophpurrer Differential Revision: D125292521
…59235) Summary: Pull Request resolved: react#59235 X-link: react/yoga#2046 X-link: facebook/litho#1093 **In one sentence.** A Java `YogaNode` with a measure function can now select Yoga's default pixel rounding, through a new `setNodeType` and its JNI binding to Yoga's existing `YGNodeSetNodeType`. ## Why this is needed Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (`YGNodeSetNodeType`); the Java binding could not. - Measured: of three nodes flexed to a third of a 100 wide row each, the first, given a measure function, ends at 33.33 and comes out 34 wide; without one, 33. ## What this diff does **`YogaNode.setNodeType(nodeType)`,** a new public open method that does nothing by default, so a `YogaNode` subclass built against an earlier class does not fail with `AbstractMethodError`. `YogaNodeJNIBase` overrides it through a new native method, `YogaNative.jni_YGNodeSetNodeTypeJNI`, which `YGJNIVanilla.cpp` registers and implements with `YGNodeSetNodeType`. `setMeasureFunction` still sets the type (text for a function, default for null), so a caller selects the type after it. ## What a Yoga user sees **A new public Yoga API.** **The Java and native halves must ship together.** `registerNatives` is strict: a Java class declaring `jni_YGNodeSetNodeTypeJNI` with a native library that lacks it, or the reverse, fails when the class registers. Changelog: [Android][Added] - Add `YogaNode.setNodeType` to select pixel rounding for measured nodes Reviewed By: christophpurrer Differential Revision: D125292521
pentiumao
force-pushed
the
export-D125292521
branch
from
October 20, 2026 16:45
e3b71b5 to
f886f82
Compare
meta-codesync Bot
pushed a commit
to react/yoga
that referenced
this pull request
Oct 20, 2026
Summary: X-link: react/react-native#59235 X-link: facebook/litho#1093 **In one sentence.** A Java `YogaNode` with a measure function can now select Yoga's default pixel rounding, through a new `setNodeType` and its JNI binding to Yoga's existing `YGNodeSetNodeType`. ## Why this is needed Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (`YGNodeSetNodeType`); the Java binding could not. - Measured: of three nodes flexed to a third of a 100 wide row each, the first, given a measure function, ends at 33.33 and comes out 34 wide; without one, 33. ## What this diff does **`YogaNode.setNodeType(nodeType)`,** a new public open method that does nothing by default, so a `YogaNode` subclass built against an earlier class does not fail with `AbstractMethodError`. `YogaNodeJNIBase` overrides it through a new native method, `YogaNative.jni_YGNodeSetNodeTypeJNI`, which `YGJNIVanilla.cpp` registers and implements with `YGNodeSetNodeType`. `setMeasureFunction` still sets the type (text for a function, default for null), so a caller selects the type after it. ## What a Yoga user sees **A new public Yoga API.** **The Java and native halves must ship together.** `registerNatives` is strict: a Java class declaring `jni_YGNodeSetNodeTypeJNI` with a native library that lacks it, or the reverse, fails when the class registers. Changelog: [Android][Added] - Add `YogaNode.setNodeType` to select pixel rounding for measured nodes Reviewed By: christophpurrer Differential Revision: D125292521 Pull Request resolved: #2046
Collaborator
|
This pull request was successfully merged by @pentiumao in 928fd14 When will my fix make it into a release? | How to file a pick request? |
|
This pull request has been merged in 928fd14. |
meta-codesync Bot
pushed a commit
to facebook/litho
that referenced
this pull request
Oct 20, 2026
Summary: X-link: react/react-native#59235 X-link: react/yoga#2046 Pull Request resolved: #1093 **In one sentence.** A Java `YogaNode` with a measure function can now select Yoga's default pixel rounding, through a new `setNodeType` and its JNI binding to Yoga's existing `YGNodeSetNodeType`. ## Why this is needed Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (`YGNodeSetNodeType`); the Java binding could not. - Measured: of three nodes flexed to a third of a 100 wide row each, the first, given a measure function, ends at 33.33 and comes out 34 wide; without one, 33. ## What this diff does **`YogaNode.setNodeType(nodeType)`,** a new public open method that does nothing by default, so a `YogaNode` subclass built against an earlier class does not fail with `AbstractMethodError`. `YogaNodeJNIBase` overrides it through a new native method, `YogaNative.jni_YGNodeSetNodeTypeJNI`, which `YGJNIVanilla.cpp` registers and implements with `YGNodeSetNodeType`. `setMeasureFunction` still sets the type (text for a function, default for null), so a caller selects the type after it. ## What a Yoga user sees **A new public Yoga API.** **The Java and native halves must ship together.** `registerNatives` is strict: a Java class declaring `jni_YGNodeSetNodeTypeJNI` with a native library that lacks it, or the reverse, fails when the class registers. Changelog: [Android][Added] - Add `YogaNode.setNodeType` to select pixel rounding for measured nodes Reviewed By: christophpurrer Differential Revision: D125292521 fbshipit-source-id: 3300bd4f48a0504bb29a7c1bd261538020f6196f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
X-link: react/yoga#2046
X-link: facebook/litho#1093
In one sentence. A Java
YogaNodewith a measure function can now select Yoga's default pixel rounding, through a newsetNodeTypeand its JNI binding to Yoga's existingYGNodeSetNodeType.Why this is needed
Installing a measure function makes a Yoga node a text node, which is rounded to the pixel grid as text: its fractional size is rounded up, and its position down, so its content is not truncated. A container measured through a callback should round as a container does, each edge to the nearest pixel. The C API can select that (
YGNodeSetNodeType); the Java binding could not.What this diff does
YogaNode.setNodeType(nodeType), a new public open method that does nothing by default, so aYogaNodesubclass built against an earlier class does not fail withAbstractMethodError.YogaNodeJNIBaseoverrides it through a new native method,YogaNative.jni_YGNodeSetNodeTypeJNI, whichYGJNIVanilla.cppregisters and implements withYGNodeSetNodeType.setMeasureFunctionstill sets the type (text for a function, default for null), so a caller selects the type after it.What a Yoga user sees
A new public Yoga API.
The Java and native halves must ship together.
registerNativesis strict: a Java class declaringjni_YGNodeSetNodeTypeJNIwith a native library that lacks it, or the reverse, fails when the class registers.Changelog:
[Android][Added] - Add
YogaNode.setNodeTypeto select pixel rounding for measured nodesReviewed By: christophpurrer
Differential Revision: D125292521