Skip to content

feat(BottomSheet): (Android only) allows to interact with the screen behind the sheet #400

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

Merged
merged 3 commits into from
Aug 21, 2022

Conversation

vallemar
Copy link
Contributor

When you have a sheet open in the middle of the screen you cannot interact with the screen behind it, this PR adds that you can interact.

For now it only supports Android, I want to make it work for iOS too

old behavior:
https://user-images.githubusercontent.com/15719383/184112618-12c07bbb-1b10-418d-809c-f19a5f81a4bd.mp4

new behavior:
https://user-images.githubusercontent.com/15719383/184112497-45eca734-d8c3-4fa8-849f-a3bd73fce1cc.mp4

@farfromrefug
Copy link
Member

@vallemar very nice. Not sure you can do that on iOS though :s Do you want me to merge this now or do you want to add iOS if possible first?

@vallemar
Copy link
Contributor Author

@farfromrefug I wouldn't know what to tell you. It is what you say, I have been trying to make it work on iOS but I have not succeeded. Do you think it would be good to merge it and if later it is achieved by us or any other, will you add it? I think I would merge it because the operation is quite useful

@farfromrefug farfromrefug merged commit d0b273c into nativescript-community:master Aug 21, 2022
@farfromrefug
Copy link
Member

@vallemar agree, merged! Will make a release soon
Thanks for your contribution
PS: i might look at the iOS side one day when i have a project that needs it. The hard thing right now with iOS is that the native lib is not maintained anymore. I might fork and release my own at one point

@vallemar
Copy link
Contributor Author

@farfromrefug Thank you! I've been seeing that on iOS you can also override the event of the view and pass it to the top view, tonight I'll try this, hopefully we could ignore the google plugin and do it via the generated views! Then I will leave a summary of what I have achieved to have it somewhere!

@vallemar
Copy link
Contributor Author

I've tried using userInteractionEnabled= false but I haven't been able to get the event to pass to the post view. I have also tried hitTest but I have not been able to make it fire

@farfromrefug
Copy link
Member

@vallemar must be because it uses a presented view controller.

@farfromrefug
Copy link
Member

@farfromrefug
Copy link
Member

@vallemar Just built with your PR. What is touch_outside view? Also are you using vscode? There was typings error about coordinator not being an android.view.View. Could you ensure you see those PR? Also can you format code with eslint before commiting?

@vallemar
Copy link
Contributor Author

Hi @farfromrefug,touch_outside I imagine it is the part of the view where the sheet is not, I saw something about this in some pages. I'm using webstorm, ok I'll check with eslint and try again what you say about android.view.View, this worked without any problem in all my tests...

@farfromrefug
Copy link
Member

@vallemar it is not a error at runtime. It is a tsc error which prevented the build of the plugin. I dont understand your point about touch_outside. You saw that in N core?

@vallemar
Copy link
Contributor Author

@farfromrefug touch_outside I didn't see it in NSCore, I saw it in android native side, I think it's the view above this view: https://github.com/nativescript-community/ui-material-components/blob/master/src/bottomsheet/bottomsheet.android.ts#L155

@farfromrefug
Copy link
Member

@vallemar ok thanks will look in material android code for it. thanks

@MrSnoozles
Copy link

MrSnoozles commented Sep 15, 2022

Copying this info written by @ammarahm-ed in Discord, so it doesn't get lost.

On iOS that will require using a regular UIView/Controller since something like a modal.doesn't allow passing touches through it.
In my RN sheet, i had to use simple View for it to work property. Inside a modal/presenter it will not work so the same might be true for bottom-sheet too.

Does that mean for iOS the implementation would have to be fundamentally different for this to work?

@vallemar
Copy link
Contributor Author

@MrSnoozles I have tried this in ios in all possible ways but without success, have you been able to do it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants