Upgrade React Native V .61 On Select Does Not Work
See original GitHub issueDescribe the bug
I updated to react native version 0.61.4 and now onSelect is not working. I am able to populate the places in the search box successfully, but when I go to select the location nothing happens. I can not select or generate any data or details about the location.
To Reproduce
Steps to reproduce the behavior:
- Set up GooglePlacesAutocomplete as github describes (https://github.com/FaridSafi/react-native-google-places-autocomplete)
- In search box, type in location
- Click on location
- View console.logs (or alert or whatever if it you need to do to see the data and details values)
- No console outputs are displayed, no data is pulled
Expected behavior
Expected to see the console display the locations details and data.
Code Example (required - issue will be closed without this)
Please provide a copy of your usage of the <GoogleAutoComplete />
component between the triple ticks below:
Click to expand!
<GooglePlacesAutocomplete
debounce={200}
ref={(c) => (googlePlacesAutocomplete = c)}
keyboardAppearance={"light"}
listViewDisplayed={false}
minLength={2}
placeholder="Search..."
autoFocus={false}
returnKeyType={"search"}
fetchDetails={true}
getDefaultValue={() => ""}
keyboardShouldPersistTaps={"always"}
query={{
key: API_KEY,
language: "en", // language of the results
types: "(cities)",
}}
styles={{
textInputContainer: {
backgroundColor: "rgba(0,0,0,0)",
borderTopWidth: 0,
borderBottomWidth: 0,
},
textInput: {
marginLeft: 0,
marginRight: 0,
height: 38,
color: "#5d5d5d",
fontSize: 16,
borderBottomWidth: 1,
borderColor: Colors.LightMustardYellow,
},
description: {
fontWeight: "bold",
fontSize: 12,
},
predefinedPlacesDescription: {
color: "black",
},
}}
renderDescription={(value) => value.description}
onPress={(data, details) => {
// 'details' is provided when fetchDetails = true
updateLocationArray(data, details, timeFrame);
googlePlacesAutocomplete._handleChangeText("");
}}
/>
Please remember to remove you google API key from the code you provide here
Alternatively, you can link to a snack.
Screenshots
If applicable, add screenshots to help explain your problem.
Where is this bug happening
- [X ] iOS
- [ X] Android
- [ X] Web
If you are using expo please indicate here:
- [ X] I am using expo
Version Information (please complete the following information)
Library Version: ^1.3.9 React Native Version: 0.61.4 Expo Version: 3.18.6
Additional context
Things I have tried: adding onBlur with console.log function, keyboardShouldPersistTaps = {“handled”}, keyboardShouldPersistTaps = “handled”, keyboardShouldPersistTaps = “always”
I know that there is a nested flatlist issue with the RN upgrade which is most likely causing the issue: VirtualizedLists should never be nested inside plain ScrollViews with the same orientation - use another VirtualizedList-backed container instead. am I am seeing threads of other people having this issue but all of the solutions have not worked for me. Not sure if it is my expo or if the package is out of date. But any help would be greatly appreciated.
Add any other context about the problem here.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top GitHub Comments
ah I got it. This article helped a lot - https://medium.com/codespace69/react-native-react-native-google-places-autocomplete-onpress-callback-not-working-23ddf2f7a98f - I needed to add the
keyboardShouldPersistTaps
to the ScrollView tag…not the GooglePlacesAutoCompletekeyboardShouldPersistTaps
doesn’t work for me