n4kz / react-native-material-dropdown

Material dropdown with consistent behaviour on iOS and Android
Other
732 stars 597 forks source link

Fix Dropdown to work in Flatlist Item #269

Open silviosampaio opened 3 years ago

silviosampaio commented 3 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

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

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-material-dropdown/src/components/dropdown/index.js b/node_modules/react-native-material-dropdown/src/components/dropdown/index.js
index b1e65a1..4ddcdb7 100644
--- a/node_modules/react-native-material-dropdown/src/components/dropdown/index.js
+++ b/node_modules/react-native-material-dropdown/src/components/dropdown/index.js
@@ -14,6 +14,7 @@ import {
 } from 'react-native';
 import Ripple from 'react-native-material-ripple';
 import { TextField } from 'react-native-material-textfield';
+import { TouchableOpacity } from 'react-native-gesture-handler'

 import DropdownItem from '../item';
 import styles from './styles';
@@ -79,7 +80,7 @@ export default class Dropdown extends PureComponent {
   };

   static propTypes = {
-    ...TouchableWithoutFeedback.propTypes,
+    ...TouchableOpacity.propTypes,

     disabled: PropTypes.bool,

@@ -726,12 +727,12 @@ export default class Dropdown extends PureComponent {

     return (
       <View onLayout={this.onLayout} ref={this.updateContainerRef} style={containerStyle}>
-        <TouchableWithoutFeedback {...touchableProps}>
+        <TouchableOpacity {...touchableProps}>
           <View pointerEvents='box-only'>
             {this.renderBase(props)}
             {this.renderRipple()}
           </View>
-        </TouchableWithoutFeedback>
+        </TouchableOpacity>

         <Modal
           visible={modal}

This issue body was partially generated by patch-package.