-
Notifications
You must be signed in to change notification settings - Fork 24.1k
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
Custom Background Colour for Modal Display #18398
Comments
Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest release, v0.54.0? Thank you for your contributions. |
I am closing this issue because it does not appear to have been verified on the latest release, and there has been no followup in a while. If you found this thread after encountering the same issue in the latest release, please feel free to create a new issue with up-to-date information by clicking here. |
Too bad as it is still there |
issue still there. check Modal.js const containerStyles = { it says: 'white' |
@JuliusKoronci & @deflorilemarului it would be really awesome if one of you could submit an PR with the fix. |
I was able to find a way around it by adding a View Parent component within the Modal and changing the background color of the View. `
` |
@tcanbolat But it has weird slide animation of the background. Dimmed background slides with the modal contents. |
@stepdi Did you manage to have a workaround for the slide animation issue? I don't want to use any other library just for this |
Any updates here? I'm also trying to dim the background without dealing with the slide animation issue, but I'm not having any luck. |
I manage to workaround this by creating an absolute positioned view taking the entire screen and putting it outside the modal, like this: export const CustomModal = () => {
...rest of the code
return (
<>
<Backdrop />
<Modal transparent>
{...}
</Modal>
</>
)
} Problem is, even though the modal is transparent, it still prevents press events on the content behind it. I wish to put an |
I was able to make the dimmed background fade independently from the sliding modal using two Modals Here's a code snippet of a sliding modal with a fading background:
|
That works for me too. The only problem is that the animations don't run parallel but rather consecutively. Has anyone found a workaround for this? |
Currently the background of Modal component is set to either
transparent
orwhite
. User should have control over the background. I'm Referring to issue #12478Environment
OS: macOS High Sierra 10.13.3
Node: 9.7.1
Yarn: Not Found
npm: 5.6.0
Watchman: Not Found
Xcode: Not Found
Android Studio: 3.0 AI-171.4443003
Packages: (wanted => installed)
react: ^16.2.0 => 16.2.0
react-native: ^0.53.0 => 0.53.0
Expected Behavior
Expected default behaviour of Modals on mobile devices, is that on display of the modal, the background page dims. Currently, the transparent property of the Modal component sets the background to either transparent or white. It would make more sense to give the user the ability to set custom background colour (e.g:
rgba(0, 0, 0, 0.4)
fordim
background)Actual Behavior
Currently the background for Modal component is either
transparent
orwhite
Solution
I was able to change the code (in
Libraries/Modal/Modal.js
) that whentransparent
isfalse
, it dims the background.However, it would be more correct to allow the user to select from a wider range of options by creating a new optional property called
overlayColor
to set the background colour forModal
component as follows:The text was updated successfully, but these errors were encountered: