feat: add overlayColor prop to modal component for customisable background overlay
Summary:
Solves these issues:
- https://github.com/facebook/react-native/issues/18398
- https://github.com/facebook/react-native/issues/12478
Solves this proposal: https://github.com/react-native-community/discussions-and-proposals/discussions/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
overlayColorto the Modal component. - Updated the background color logic to prioritize
overlayColorwhen transparent isfalse. - Ensured backward compatibility by defaulting to
whitewhenoverlayColoris 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'.
@shubhamguptadream11 Thanks for submitting the PR. Let me try to review this next week.
@alanleedev has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@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)
@alanleedev Renamed the prop. Please check whenever you feel free. Thanks for feedback!
@alanleedev has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.
@alanleedev merged this pull request in facebook/react-native@4e1d7015c1d4e2703133b1347ed97a0cc93b1318.
This pull request was successfully merged by @shubhamguptadream11 in 4e1d7015c1d4e2703133b1347ed97a0cc93b1318
When will my fix make it into a release? | How to file a pick request?
@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?