Skip to content
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

chore(android): remove onBackPressed function in FullScreenPlayerView #4049

Merged

Conversation

seyedmostafahasani
Copy link
Collaborator

@seyedmostafahasani seyedmostafahasani commented Aug 2, 2024

Summary

Removed the onBackPressed function.

Motivation

I fixed a potential issue where the setFullscreen method was not being called if the user did not press the back button.
fix #4047, #4057

Changes

Test plan

@KrzysztofMoch
Copy link
Member

@seyedmostafahasani correct me if I am wrong but this should fix #4047 ?

@seyedmostafahasani
Copy link
Collaborator Author

@seyedmostafahasani correct me if I am wrong but this should fix #4047 ?

I think this PR can resolve it.

@sntg-p
Copy link

sntg-p commented Aug 2, 2024

What happens if the user does not press the system back button but they press a button that invokes navigation.goBack()? In this case navigation comes from React Navigation but it could be whatever routing solution the app is using.

@seyedmostafahasani
Copy link
Collaborator Author

seyedmostafahasani commented Aug 2, 2024

What happens if the user does not press the system back button but they press a button that invokes navigation.goBack()? In this case navigation comes from React Navigation but it could be whatever routing solution the app is using.

@sntg-p I just want to be sure that I get you correctly. For full-screen mode you navigate to another screen and use the prop fullscreen={true}. To exit this mode you call the goBack() function.

@sntg-p
Copy link

sntg-p commented Aug 2, 2024

@sntg-p I just want to be sure that I get you correctly. For full-screen mode you navigate to another screen and use the prop fullscreen={true}. To exit this mode you call the goBack() function.

This is currently not working properly as I mentioned in #4047. Not really sure if this PR fixes that, as I didn't test it.

@seyedmostafahasani
Copy link
Collaborator Author

seyedmostafahasani commented Aug 3, 2024

@sntg-p would you please share your code with me if it's possible or sample of your code?

@mkbhdana
Copy link

What happens if the user does not press the system back button but they press a button that invokes navigation.goBack()? In this case navigation comes from React Navigation but it could be whatever routing solution the app is using.

That's exactly i am using and then statusbar and navbar gets hidden

@seyedmostafahasani
Copy link
Collaborator Author

@sntg-p @mkbhdana
Could you please use the setFullScreen method as shown below?

const exitFullScreen = () => {
    navigation.goBack();
    setFullScreen(false);
}

@mkbhdana
Copy link

@sntg-p @mkbhdana Could you please use the setFullScreen method as shown below?

const exitFullScreen = () => {
    navigation.goBack();
    setFullScreen(false);
}

Already added in my task list to try this in my available time.

@freeboub
Copy link
Collaborator

I think there is a side effect here. If you go to full screen, leave the app (press home), and go back to the app, full screen will be dismissed as onStop has been called.
Can you please double check that ?

@mkbhdana
Copy link

I think there is a side effect here. If you go to full screen, leave the app (press home), and go back to the app, full screen will be dismissed as onStop has been called. Can you please double check that ?

i tried it on my app and fullscreen stays

@seyedmostafahasani
Copy link
Collaborator Author

I think there is a side effect here. If you go to full screen, leave the app (press home), and go back to the app, full screen will be dismissed as onStop has been called. Can you please double check that ?

I tested your scenario, and the app works correctly. I pressed the home button, then I went back to the app, but the app was in full-screen mode. onStop doesn't get called when I press the home button or background the app.

@seyedmostafahasani
Copy link
Collaborator Author

@mkbhdana
Would you please share a sample of your code with me?
I think your issue is not related to this PR.

@seyedmostafahasani
Copy link
Collaborator Author

seyedmostafahasani commented Aug 22, 2024

@sntg-p @mkbhdana
I think this PR (#4112) can resolve your issue.

@mkbhdana
Copy link

@mkbhdana Would you please share a sample of your code with me? I think your issue is not related to this PR.

well setFullscreen also not resolved my issue

i just used react-native-system-navigation-bar this library and calling SystemNavigationBar.fullScreen(false); on onBack handler and this solves my entire problem with status and navigation bar while keeping fullscreen={true} in react native video component

@mkbhdana
Copy link

mkbhdana commented Aug 22, 2024

@sntg-p also I find if I keep fullscreen = true then then navigation bar adds some space above it after dismissing video so to solve it I set fullscreen = false in video commponent and instead I use SystemNavigationBar.fullScreen(true); and SystemNavigationBar.immersive(); inside useEffect so it helped to resolve the issue.

@seyedmostafahasani
Copy link
Collaborator Author

@KrzysztofMoch
If you have enough time please check out this PR.

@freeboub
Copy link
Collaborator

freeboub commented Sep 5, 2024

@seyedmostafahasani I fix conflicts manually, can you double it is still working on your side and we can merge ?

@seyedmostafahasani
Copy link
Collaborator Author

@freeboub
First of all, thank you for resolving the conflicts. I tested it, and everything works correctly. It's ready to merge.

@freeboub freeboub merged commit 4a2beaa into TheWidlarzGroup:master Sep 5, 2024
3 checks passed
@seyedmostafahasani seyedmostafahasani deleted the refactor/fullScreenPlayer branch September 19, 2024 08:06
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.

[BUG]: Android navigation bar stays hidden after video using fullscreen no longer mounted
5 participants