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

Please add modalBackgroundColor prop #108

Closed
moremi opened this issue Mar 11, 2021 · 1 comment
Closed

Please add modalBackgroundColor prop #108

moremi opened this issue Mar 11, 2021 · 1 comment

Comments

@moremi
Copy link

moremi commented Mar 11, 2021

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-material-menu@1.2.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-material-menu/src/Menu.js b/node_modules/react-native-material-menu/src/Menu.js
index 597812c..0fd9e18 100644
--- a/node_modules/react-native-material-menu/src/Menu.js
+++ b/node_modules/react-native-material-menu/src/Menu.js
@@ -189,7 +189,7 @@ class Menu extends React.Component {
     const animationStarted = menuState === STATES.ANIMATING;
     const modalVisible = menuState === STATES.SHOWN || animationStarted;
 
-    const { testID, button, style, children } = this.props;
+    const { testID, button, style, children, modalBackgroundColor } = this.props;
 
     return (
       <View ref={this._setContainerRef} collapsable={false} testID={testID}>
@@ -208,7 +208,7 @@ class Menu extends React.Component {
           transparent
         >
           <TouchableWithoutFeedback onPress={this._hide} accessible={false}>
-            <View style={StyleSheet.absoluteFill}>
+            <View style={{...StyleSheet.absoluteFill, ...(modalBackgroundColor && {backgroundColor: modalBackgroundColor} || undefined)}}>
               <Animated.View
                 onLayout={this._onMenuLayout}
                 style={[
@@ -233,6 +233,7 @@ class Menu extends React.Component {
 
 Menu.defaultProps = {
   animationDuration: 300,
+  modalBackgroundColor: null,
 };
 
 const styles = StyleSheet.create({

This issue body was partially generated by patch-package.

@mxck
Copy link
Owner

mxck commented Mar 11, 2021

@moremi Hi! Thanks for the suggestion. Can you do a PR?
Also, do you think it would be useful for the user to change the whole style instead of only backgroundColor?

@mxck mxck closed this as completed Aug 23, 2021
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

No branches or pull requests

2 participants