Skip to content

Add edge-to-edge support #18

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 2 commits into from
Mar 10, 2025
Merged

Conversation

zoontek
Copy link
Contributor

@zoontek zoontek commented Mar 8, 2025

edge-to-edge.mp4

Following https://github.com/nandforojo/galeria/issues/16 (ping @hirbod)

This PR add support for edge-to-edge layout. It adds a new prop: edgeToEdge, that is always true when react-native-edge-to-edge is installed.

I would recommand to expose the edgeToEdge prop in the TypeScript types for non react-native-edge-to-edge users that also wants edge-to-edge (currently, it's not, check the GaleriaViewProps type vs the actual accepted Galeria props).


override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return Dialog(requireActivity(), R.style.Theme_FullScreenDialog).apply {
setCanceledOnTouchOutside(true)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept the ImageViewerDialogFragment behavior, just changed the applied theme on the Dialog instance.

return Dialog(requireActivity(), R.style.Theme_FullScreenDialog).apply {
setCanceledOnTouchOutside(true)

window?.let {
Copy link
Contributor Author

@zoontek zoontek Mar 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we enters edge-to-edge, and set the system bars colors based on the chosen theme. It's safe as it operates in a different Window (the Dialog one, compared to the MainActivity one), so it will not mess with SystemBars, StatusBar, etc.

@zoontek zoontek changed the base branch from v1 to master March 8, 2025 09:55
@nandorojo
Copy link
Owner

good to merge?

@zoontek
Copy link
Contributor Author

zoontek commented Mar 10, 2025

@nandorojo Totally, yes

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.

4 participants