toystars / react-native-multiple-select

Simple multi-select component for react-native
MIT License
565 stars 314 forks source link

Added submitButtonTextStyle, and submitButtonStyle #214

Open simdanonline opened 1 year ago

simdanonline commented 1 year ago

Hi! πŸ‘‹

Firstly, thanks for your work on this project! πŸ™‚

Today I used patch-package to patch react-native-multiple-select@0.5.12 for the project I'm working on.

I added submitButtonTextStyle, and submitButtonStyle for who ever wants to able to style something else asides submit button color.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-multiple-select/index.d.ts b/node_modules/react-native-multiple-select/index.d.ts
index 07da82c..828be31 100644
--- a/node_modules/react-native-multiple-select/index.d.ts
+++ b/node_modules/react-native-multiple-select/index.d.ts
@@ -39,6 +39,8 @@ export interface MultiSelectProps {
     hideDropdown?: boolean;
     submitButtonColor?: string;
     submitButtonText?: string;
+    submitButtonTextStyle?: StyleProp<TextStyle>;
+    submitButtonStyle?: StyleProp<ViewStyle>;
     textColor?: string;
     fontSize?: number;
     fixedHeight?: boolean;
diff --git a/node_modules/react-native-multiple-select/lib/react-native-multi-select.js b/node_modules/react-native-multiple-select/lib/react-native-multi-select.js
index 9b7a0d7..7169295 100644
--- a/node_modules/react-native-multiple-select/lib/react-native-multi-select.js
+++ b/node_modules/react-native-multiple-select/lib/react-native-multi-select.js
@@ -71,6 +71,8 @@ export default class MultiSelect extends Component {
     hideDropdown: PropTypes.bool,
     submitButtonColor: PropTypes.string,
     submitButtonText: PropTypes.string,
+    submitButtonTextStyle: TextPropTypes.style,
+    submitButtonStyle: ViewPropTypes.style,
     textColor: PropTypes.string,
     fontSize: PropTypes.number,
     fixedHeight: PropTypes.bool,
@@ -577,6 +579,8 @@ export default class MultiSelect extends Component {
       styleTextDropdownSelected,
       searchIcon,
       styleIndicator,
+      submitButtonTextStyle,
+      submitButtonStyle,
     } = this.props;
     const { searchTerm, selector } = this.state;
     return (
@@ -647,13 +651,15 @@ export default class MultiSelect extends Component {
                   onPress={() => this._submitSelection()}
                   style={[
                     styles.button,
-                    { backgroundColor: submitButtonColor }
+                    { backgroundColor: submitButtonColor },
+                    submitButtonStyle,
                   ]}
                 >
                   <Text
                     style={[
                       styles.buttonText,
-                      fontFamily ? { fontFamily } : {}
+                      fontFamily ? { fontFamily } : {},
+                      submitButtonTextStyle,
                     ]}
                   >
                     {submitButtonText}

This issue body was partially generated by patch-package.