New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the shadow node for proper laying out Aztec on Android #1093
Implement the shadow node for proper laying out Aztec on Android #1093
Conversation
Hey @hypest, I tested this branch a little bit and it seems that it's an improvement 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️ Way better than before. LGTM!
...ec/android/src/main/java/org/wordpress/mobile/ReactNativeAztec/ReactAztecTextShadowNode.java
Outdated
Show resolved
Hide resolved
if (extraData instanceof ReactTextUpdate) { | ||
ReactTextUpdate update = (ReactTextUpdate) extraData; | ||
|
||
view.setPadding( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting this warning in AS about these lines for RTL compatibility:
For RtL compatibility, use setPaddingRelativeor ViewCompat.setPaddingRelative() when setting left/right padding. less... (Ctrl+F1)
Inspection info:For RtL compatibility, use setPaddingRelativeor ViewCompat.setPaddingRelative() when setting left/right padding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a local linting issue on my end.. I couldn't determine why it gave this warning when ReactTextUpdate
merely inherits from java.lang.Object
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm getting this warning in AS about these lines for RTL compatibility:
Good point. I've been actually mirroring the code in upstream's implementation of the TextInput shadow node here: https://github.com/facebook/react-native/blob/d88e4701fc46b028861ddcfa3e6ffb141b3ede3d/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactTextInputManager.java#L193-L197
I'm kinda torn but, I think it makes more sense at the moment to follow upstream's lead on this one. Alternatively, we can even completely remove the code to set the padding since it's not a real goal for this PR anyway. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes more sense at the moment to follow upstream's lead on this one.
I agree, this seems like the best way forward. I haven't tested many scenarios without the code (only the "Lorem ipsum" test in the description), and I'm unsure if there are scenarios where it would be important to have it. So keeping it close to upstream seems the sensible approach. LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested these changes and it's very smooth now! 😃
Addresses #1091
This PR implements the shadow node logic for the Aztec wrapper custom React Native view. This is needed for better View calculations.
This work begun as an attempt to remove the need to specify the
minHeight
style on the Aztec wrapper. I think that the view should be able to update its height automatically within RN and the Android layout system, without us manually having to set it as a style prop. In that respect, the effort here is not finished; theminHeight
style is still needed (try removing it and you'll see that the wrapper doesn't update its height properly, although its now initial height is much better than before). Although, my experiments so far with a basic demo app (in repo: https://github.com/hypest/RN060-aztec-experiments) seem to work and the Aztec wrapper there seems fine without specifying anyminHeight
.Even in this state, the behavior in this PR is better than before and that's why I'm opening this PR.
Known issue: the height of the component seems smaller than the content text but only by a little. The
onContentSizeChange
logic repairs it but it's still visible. Besides, the glitch is minimized due to the work on #1076 and that's why this PR builds on top of that, albeit in a separate PR so #1076 doesn't get blocked/complex.To test:
I have also
Update release notes:
RELEASE-NOTES.txt
.