-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[RNMobile] Fix BottomSheet.SubSheet/TextInput Conflict #33845
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
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.
My understanding from the PR description and testing is that the creation of this component within the render of its parent
BottomSheetSubSheet
is the root cause of the issue, correct?I am not suggesting we change this PR, but I wanted to share the below alternative that is closer to the original implementation, purely for discussion's sake. It would appear merely hoisting
BottomSheetScreen
out ofBottomSheetSubSheet
does fix the original keyboard/focus issue.Alternative Approach
Edit: Updated the diff to showcase the difference between the original implementation, instead of the difference between this PR.
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 for this, David! 🙇♀️ You're right on what I believe to be the root cause of this issue (i.e. the creation of the child component within the parent). I appreciate you sharing that alternative approach, as hoisting the component isn't something I'd have come up with by myself, so will add it to my knowledge bank going forward.
Are there any positives or negatives to either approach? I'm definitely open to learning and updating the PR if there is anything steering you towards or away from either approach. If it's the case that they're fairly similar, with no major advantages/disadvantages to one another, I'll go ahead to merge the current PR.
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.
No, I wouldn't say there is a distinct positive or negative with either approach. It is merely differently structured code from my perspective.
That said, after reviewing this again, I believe this wrapping
BottomSheetConsumer
may be duplicative of the newuseContext
usage and unnecessary. I.e. we could likely removeBottomSheetConsumer
altogether.For an explanation as to why, both of the above are accessing the React Context object. The former is using the
Context.Consumer
approach. The latter is using the React Hook approach. Either is fine. I believe this project generally attempts to rely upon React Hooks now-a-days.Currently, this PR has a lingering
BottomSheetConsumer
that is largely going unused.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.
Ah, excellent, that's clear, thanks for the explanation! I've gone ahead to remove code surrounding that unnecessary
BottomSheetConsumer
in 5232398 and b75e766. I also tested and can confirm the alt text settings still work with the update.