1
- import { SafeAreaView , StyleSheet , View , Text } from 'react-native' ;
1
+ import { SafeAreaView , StyleSheet , View , Text , ScrollView } from 'react-native' ;
2
2
import GooglePlacesTextInput from 'react-native-google-places-textinput' ;
3
3
4
4
const App = ( ) => {
@@ -65,6 +65,7 @@ const App = () => {
65
65
66
66
return (
67
67
< SafeAreaView style = { styles . container } >
68
+ { /* Basic usage example with minimal configuration */ }
68
69
< View style = { styles . section } >
69
70
< Text style = { styles . sectionTitle } > Basic Example</ Text >
70
71
< GooglePlacesTextInput
@@ -76,6 +77,7 @@ const App = () => {
76
77
/>
77
78
</ View >
78
79
80
+ { /* Example showing custom styling and filtered place types */ }
79
81
< View style = { styles . section } >
80
82
< Text style = { styles . sectionTitle } > Styled Example</ Text >
81
83
< GooglePlacesTextInput
@@ -90,6 +92,7 @@ const App = () => {
90
92
/>
91
93
</ View >
92
94
95
+ { /* Example demonstrating how to fetch detailed place information */ }
93
96
< View style = { styles . section } >
94
97
< Text style = { styles . sectionTitle } > Place Details Example</ Text >
95
98
< GooglePlacesTextInput
@@ -139,23 +142,29 @@ const App = () => {
139
142
/>
140
143
</ View >
141
144
145
+ { /* This example shows how to properly integrate GooglePlacesTextInput inside a vertical ScrollView */ }
142
146
< View style = { styles . section } >
143
- < Text style = { styles . sectionTitle } > Scroll Disabled Example</ Text >
144
- < GooglePlacesTextInput
145
- apiKey = "YOUR_API_KEY_HERE"
146
- placeHolderText = "Try scrolling these results"
147
- onPlaceSelect = { ( place ) => {
148
- console . log ( 'Scroll disabled example, selected:' , place ) ;
149
- } }
150
- scrollEnabled = { false }
151
- nestedScrollEnabled = { false }
152
- style = { {
153
- container : {
154
- width : '100%' ,
155
- paddingHorizontal : 16 ,
156
- } ,
157
- } }
158
- />
147
+ < ScrollView
148
+ keyboardShouldPersistTaps = "handled"
149
+ nestedScrollEnabled = { true }
150
+ >
151
+ < Text style = { styles . sectionTitle } > Scroll Disabled Example</ Text >
152
+ < GooglePlacesTextInput
153
+ apiKey = "YOUR_API_KEY_HERE"
154
+ placeHolderText = "Try scrolling these results"
155
+ onPlaceSelect = { ( place ) => {
156
+ console . log ( 'Scroll disabled example, selected:' , place ) ;
157
+ } }
158
+ scrollEnabled = { false }
159
+ nestedScrollEnabled = { false }
160
+ style = { {
161
+ container : {
162
+ width : '100%' ,
163
+ paddingHorizontal : 16 ,
164
+ } ,
165
+ } }
166
+ />
167
+ </ ScrollView >
159
168
</ View >
160
169
</ SafeAreaView >
161
170
) ;
0 commit comments