-
Notifications
You must be signed in to change notification settings - Fork 58
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
HTMLInputView refactor to better share code. #781
Conversation
I like it, and don't think it is way more complex, but I checked the code some times already, that i'm familiar with it. |
hey @etoledom thank you for tackling this ! I can understand the code but I've been maintaining this code for the last 3-4 weeks, I've also written unit-tests for it so currently I almost memorized every part of it :) but for someone who'll see this code for the first time I don't think it is very intuitive. Although, I'd want to keep most of the things about this PR. I'd just try not to get away from standard way of adding a child component in React Native, which is just adding So instead of dynamically creating the content we can just:
I know this adds some isAndroid checks but I think it is much more simpler to understand. Personally, it feels more safe to me in terms of performance also, since it is the standard way of adding a child component(haven't calculated any metrics though). In this case I think renaming HTMLInputViewUI as something like HTMLInputViewContainer would make sense. |
Thank you @daniloercoli and @pinarol for the review.
This and the code sample gave me an idea to simplify everything a bit more. @pinarol please let me know if that's what you had in mind :) |
That's so interesting, sth must have changed on Android side 🤔But it is good news also. I tested on Android and it works all ok with the current version of the code! |
yes exactly, even better if you consider we don't need the dynamic height anymore. |
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.
Thanks @etoledom I think this looks awesome! I just added some very simple comments to remove unnecessary lines.
I tested with both ios and android, working pretty good! But it'd be good if @daniloercoli could also approve for Android side.
src/components/html-text-input-ui/html-text-input-ui.android.js
Outdated
Show resolved
Hide resolved
src/components/html-text-input-ui/html-text-input-ui.android.js
Outdated
Show resolved
Hide resolved
src/components/html-text-input-ui/html-text-input-ui.android.js
Outdated
Show resolved
Hide resolved
Thank you @pinarol ! |
This PR tries to implement HTMLInputView in a way that more code is shared between platforms, and branching just the necessary parts.
Since there were challenges sharing the HTML TextView that is the main component, and needs a slightly different configuration, the final result is not as strait forward as one would have liked.
Ideally we can check this out, and see if we like it enough to merge.
If this is more complex than it helps, it's all good to not merge and keep
HTMLInputView
as it is.