jaing / react-native-places-input

MIT License
46 stars 18 forks source link

type declarations for react-native-places-input #36

Open caglar09 opened 1 year ago

caglar09 commented 1 year ago

Hi! ๐Ÿ‘‹

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

Today I used patch-package to patch react-native-places-input@1.1.7 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-places-input/PlacesInput.d.ts b/node_modules/react-native-places-input/PlacesInput.d.ts
new file mode 100644
index 0000000..5f21ff9
--- /dev/null
+++ b/node_modules/react-native-places-input/PlacesInput.d.ts
@@ -0,0 +1,37 @@
+import * as React from 'react';
+import { TextInputProps } from 'react-native';
+
+export interface PlacesInputProps {
+  clearQueryOnSelect?: boolean;
+  contentScrollViewBottom?: React.ReactNode;
+  contentScrollViewTop?: React.ReactNode;
+  stylesInput?: React.CSSProperties;
+  stylesContainer?: React.CSSProperties;
+  stylesList?: React.CSSProperties;
+  stylesItem?: React.CSSProperties;
+  stylesItemText?: React.CSSProperties;
+  stylesLoading?: React.CSSProperties;
+  resultRender?: (place: any) => React.ReactNode;
+  query?: string;
+  queryFields?: string;
+  queryCountries?: string[];
+  queryTypes?: string;
+  querySession?: string;
+  searchRadius?: number;
+  searchLatitude?: number;
+  searchLongitude?: number;
+  googleApiKey: string;
+  placeHolder?: string;
+  textInputProps?: TextInputProps;
+  iconResult?: React.ReactNode;
+  iconInput?: React.ReactNode;
+  language?: string;
+  onSelect?: (place: any) => void;
+  onChangeText?: (query: string, instance: PlacesInput) => void;
+  requiredCharactersBeforeSearch?: number;
+  requiredTimeBeforeSearch?: number;
+}
+
+declare class PlacesInput extends React.Component<PlacesInputProps> {}
+
+export default PlacesInput;
diff --git a/node_modules/react-native-places-input/index.js b/node_modules/react-native-places-input/index.js
index ffa45ae..4c9019c 100755
--- a/node_modules/react-native-places-input/index.js
+++ b/node_modules/react-native-places-input/index.js
@@ -2,6 +2,7 @@ import React, {Component} from 'react';
 import PropTypes from 'prop-types';
 import {
   ActivityIndicator,
+  ScrollView,
   StyleSheet,
   Text,
   TextInput,
@@ -51,12 +52,13 @@ class PlacesInput extends Component {
           }}
           value={this.state.query}
           onFocus={() => this.setState({showList: true})}
-          onBlur={() => this.setState({showList: false})}
+          // onBlur={() => this.setState({showList: false})}
           {...this.props.textInputProps}
           clearButtonMode="always"
+          
         />
         {this.state.showList && (
-          <View
+          <ScrollView
             style={[styles.scrollView, this.props.stylesList]}
             keyboardShouldPersistTaps="always"
           >
@@ -82,7 +84,7 @@ class PlacesInput extends Component {
               );
             })}
             {this.props.contentScrollViewBottom}
-          </View>
+          </ScrollView>
         )}
       </View>
     );

This issue body was partially generated by patch-package.