I’m working on a react-native app and I have to put GooglePlacesAutocomplete
in a Scrollview.This is the following code.
<ScrollView style={{flex: 1}>
<GooglePlacesAutocomplete
minLength={2}
nearbyPlacesAPI={'GooglePlacesSearch'}
debounce={400}
placeholder="Origin Address"
query={{
key: GOOGLE_MAPS_API_KEY,
language: 'en',
}}
onFail={error => console.log(error)}
enablePoweredByContainer={false}
onPress={(data, details = null) => {
console.log(details.geometry.location);
}}
fetchDetails={true}
returnkeyType={'search'}
/>
</ScrollView>
Errors
: VirtualizedLists should never be nested inside plain ScrollViews with the same orientation because it can break windowing and other functionality – use another VirtualizedList-backed container instead.
2
Answers
this error when you add vertival flatList inside ScrolView so try one of this :
acording to react-native-google-places-autocomplete docs
ther is section says:
Use Inside a or
If you need to include this component inside a ScrolView or FlatList, remember to apply the keyboardShouldPersistTaps attribute to all ancestors ScrollView or FlatList (see this issue comment).