feat: Add Android Paper implementation of inset logical properties#36242
feat: Add Android Paper implementation of inset logical properties#36242gabrieldonadel wants to merge 3 commits intofacebook:mainfrom
Conversation
Base commit: a6690bf |
|
Left a comment on the iOS PR around the precedence, but yeah, I think that is the main thing left here. Thank you for splitting these as well! |
|
Hey @NickGerleman, I'm glad to share that I managed to fix the precedence problem on Android as well. Fix this by using a very similar approach to #36241, adding a |
Summary: This PR adds Paper support to `inset` logical properties on iOS as requested on #34425. This implementation includes the addition of the following style properties - `inset`, equivalent to `top`, `bottom`, `right` and `left`. - `insetBlock`, equivalent to `top` and `bottom`. - `insetBlockEnd`, equivalent to `bottom`. - `insetBlockStart`, equivalent to `top`. - `insetInline`, equivalent to `right` and `left`. - `insetInlineEnd`, equivalent to `right` or `left`. - `insetInlineStart`, equivalent to `right` or `left`. Android changes are in a separate PR to facilitate code review #36242 ## Changelog [IOS] [ADDED] - Add Paper implementation of inset logical properties Pull Request resolved: #36241 Test Plan: 1. Open the RNTester app and navigate to the `View` page 2. Test the new style properties through the `Insets` section  Reviewed By: lunaleaps Differential Revision: D43525110 Pulled By: NickGerleman fbshipit-source-id: b70b0ef183dcf192b2c3547422bbe161b7bdba50
NickGerleman
left a comment
There was a problem hiding this comment.
It looks like there is already a pattern for this in ReactShadowNodeImpl, e.g:
private final float[] mPadding = new float[Spacing.ALL + 1];
private final boolean[] mPaddingIsPercent = new boolean[Spacing.ALL + 1];Could we put these in the same place, with the same implementation?
We should also change up Spacing.ALL. E.g. rename that to Spacing.ALL_EDGES, then make Spacing.ALL include everything (and use it where we support the extra values).
ReactAndroid/src/main/java/com/facebook/react/uimanager/LayoutShadowNode.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
I'm looking closer at the impl of this, and spacingType is translated directly to a Yoga Edge.
We already added some more different values to Spacing, but since these can only accept Yoga Edge parameters, is it possible to use a more constrained type? E.g. changing sinks which expect a valid Yoga enum to instead use YogaEdge?
There was a problem hiding this comment.
Dynamic is probably heavier than we need here. Could keep these as MutableYogaValue?
|
Sorry for the delay on this, I'll try to take a look this week*! |
2529150 to
ce89208
Compare
ce89208 to
6f35c5b
Compare
…ook#36241) Summary: This PR adds Paper support to `inset` logical properties on iOS as requested on facebook#34425. This implementation includes the addition of the following style properties - `inset`, equivalent to `top`, `bottom`, `right` and `left`. - `insetBlock`, equivalent to `top` and `bottom`. - `insetBlockEnd`, equivalent to `bottom`. - `insetBlockStart`, equivalent to `top`. - `insetInline`, equivalent to `right` and `left`. - `insetInlineEnd`, equivalent to `right` or `left`. - `insetInlineStart`, equivalent to `right` or `left`. Android changes are in a separate PR to facilitate code review facebook#36242 ## Changelog [IOS] [ADDED] - Add Paper implementation of inset logical properties Pull Request resolved: facebook#36241 Test Plan: 1. Open the RNTester app and navigate to the `View` page 2. Test the new style properties through the `Insets` section  Reviewed By: lunaleaps Differential Revision: D43525110 Pulled By: NickGerleman fbshipit-source-id: b70b0ef183dcf192b2c3547422bbe161b7bdba50
|
What are the next steps to get this PR merged? |
|
For 0.72 we took the step of adding Fabric specific typings for this and the others. |
|
Do we still need these in Paper? If time is limited, I think we're better off focusing on fleshing out support in Fabric than the legacy renderer. |
|
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
Should we still implement these? |
As of recent we've been wanting to avoid changes to Paper. Since The gap we have for logical property new arch support is on borders. Solving that in the short term would like adding support in the Android View View Manager, along with the iOS View ComponentView, to the existing structure resolving edge values. There's a longer term change, I am trying to allocate time to make, which would eventually move built-in view managers and component views to a "computed style", which would mean view managers and component views only have to deal with the four physical edges. |
|
This PR is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
|
This PR was closed because it has been stalled for 7 days with no activity. |
Summary:
This PR adds Paper support to
insetlogical properties on Android as requested on #34425. This implementation includes the addition of the following style propertiesinset, equivalent totop,bottom,rightandleft.insetBlock, equivalent totopandbottom.insetBlockEnd, equivalent tobottom.insetBlockStart, equivalent totop.insetInline, equivalent torightandleft.insetInlineEnd, equivalent torightorleft.insetInlineStart, equivalent torightorleft.One thing that still needs to be figured out is how to respect the same precedence as here when using Paper (cc @NickGerleman)
iOS changes are in a separate PR to facilitate code review #36241
Changelog:
[ANDROID] [ADDED] - Add Paper implementation of inset logical properties
Test Plan:
ViewpageInsetssection