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

feat: add overlayColor prop to modal component for customisable background overlay #46322

Conversation

shubhamguptadream11
Copy link
Contributor

@shubhamguptadream11 shubhamguptadream11 commented Sep 4, 2024

Summary:

Solves these issues:

Solves this proposal: react-native-community/discussions-and-proposals#774

Changelog:

[GENERAL] [ADDED] - added overlayColor prop to modal component for customisable background overlay

Motivation:
Currently, the React Native Modal component only allows the background to be set to either transparent or white. This limits the ability to dim the background or apply custom colors, which is essential for creating a more polished and user-friendly interface.

Change Log:

Modal Component Enhancements:

  • Introduced a new optional prop overlayColor to the Modal component.
  • Updated the background color logic to prioritize overlayColor when transparent is false.
  • Ensured backward compatibility by defaulting to white when overlayColor is not provided.

Test Plan:

  • Test the changes on both iOS and Android devices/emulators to ensure consistent behavior.
  • Added example in rn-tester app

Sample screenshot with custom overlayColor passed as 'red'.

simulator_screenshot_4F112217-7AD5-4030-8A18-6260AD32988A

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. labels Sep 4, 2024
@alanleedev
Copy link
Contributor

@shubhamguptadream11 Thanks for submitting the PR. Let me try to review this next week.

@facebook-github-bot
Copy link
Contributor

@alanleedev has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@alanleedev
Copy link
Contributor

alanleedev commented Sep 12, 2024

@shubhamguptadream11 Everything looks good but could you change the name overlayColor to backdropColor ? We are not overlaying anything over the modal so backdrop seems to be a better term here.
(Reference: https://developer.mozilla.org/en-US/docs/Web/CSS/::backdrop)

@shubhamguptadream11
Copy link
Contributor Author

@alanleedev Renamed the prop. Please check whenever you feel free.
Thanks for feedback!

@facebook-github-bot
Copy link
Contributor

@alanleedev has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@alanleedev merged this pull request in 4e1d701.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Sep 16, 2024
@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @shubhamguptadream11 in 4e1d701

When will my fix make it into a release? | How to file a pick request?

@alanleedev
Copy link
Contributor

@shubhamguptadream11 hm... the merged commit did not have your name change for some reason. I'll do the name change again.

This pull request was successfully merged by @shubhamguptadream11 in 4e1d701

When will my fix make it into a release? | How to file a pick request?

alanleedev added a commit to alanleedev/react-native that referenced this pull request Sep 16, 2024
Summary:
the name change [commit](facebook@64ee571) was not properly imported from last diff for facebook#46322

redoing the name change: overlayColor -> backdropColor

Changelog:
[general][Fixed] - rename overlayColor prop in Modal to backdropColor

Differential Revision: D62760028
facebook-github-bot pushed a commit that referenced this pull request Sep 16, 2024
Summary:
Pull Request resolved: #46523

the name change [commit](64ee571) was not properly imported from last diff for #46322

redoing the name change: overlayColor -> backdropColor

Changelog:
[general][Fixed] - rename overlayColor prop in Modal to backdropColor

Reviewed By: christophpurrer

Differential Revision: D62760028

fbshipit-source-id: 92d6e8f002c92f4e13136542dce946434516988e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants