Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't select a location if KeyboardAwareScrollView have props onTouchStart and onTouchEnd #679

Closed
1 task done
vokecodes opened this issue Dec 24, 2020 · 3 comments
Closed
1 task done
Labels

Comments

@vokecodes
Copy link

vokecodes commented Dec 24, 2020

Below is my code

<KeyboardAwareScrollView
            enableOnAndroid={true}
            enableAutomaticScroll={Platform.OS === "ios"}
            showsVerticalScrollIndicator={false}
            keyboardShouldPersistTaps="handled"
            scrollEnabled={scroll}
            onTouchStart={(event) => {
              if (event.nativeEvent.locationY < 300) setScroll(false);
            }}
            onTouchEnd={(event) => {
              setScroll(true);
            }}
          >
            <View style={styles.container}>
              <Text style={styles.label}>Where did this happen?</Text>
              <View style={{ flexDirection: "row", marginLeft: -10 }}>
                <GooglePlacesAutocomplete
                  // placeholder="Where are you going?"
                  // placeholderTextColor={accentOrange}
                  minLength={2} // minimum length of text to search
                  // autoFocus={true}
                  returnKeyType={"search"} // Can be left out for default return key https://facebook.github.io/react-native/docs/textinput.html#returnkeytype
                  listViewDisplayed="false" // true/false/undefined
                  fetchDetails={true}
                  onPress={(data, details) => {
                    // 'details' is provided when fetchDetails = true
                    let address = data.description;
                    handleInput("location", address);
                  }}
                  query={{
                    key: GOOGLE_PLACES_API_KEY,
                    language: "en",
                    types: "(cities)",
                  }}
                  enablePoweredByContainer={false}
                  renderDescription={
                    (row) => row.description
                    // row.description || row.name || row.formatted_address
                  } // custom description render
                  keyboardAppearance="light"
                  keyboardShouldPersistTaps="handled"
                  currentLocation={false}
                  // currentLocationLabel="Current Location"
                  nearbyPlacesAPI="GooglePlacesSearch" // Which API to use: GoogleReverseGeocoding or GooglePlacesSearch
                  GooglePlacesSearchQuery={{
                    // available options for GooglePlacesSearch API : https://developers.google.com/places/web-service/search
                    rankby: "distance",
                  }}
                  filterReverseGeocodingByTypes={[
                    "locality",
                    "administrative_area_level_3",
                  ]} // filter the reverse geocoding results by types - ['locality', 'administrative_area_level_3'] if you want to display only cities
                  // predefinedPlaces={[homePlace, workPlace]}
                  debounce={200} // debounce the requests in ms. Set to 0 to remove debounce. By default 0ms.
                  renderLeftButton={() => (
                    <Ionicons
                      name="ios-pin"
                      size={20}
                      // color={location.destination ? "#fff" : accentOrange}
                      style={styles.searchIcon}
                    />
                  )}
                  styles={placeStyles}
                />
              </View>
            </View>
          </KeyboardAwareScrollView>
  • I am using expo

I changed keyboardShouldPersistTaps always still the same thing.

@vokecodes vokecodes added the bug label Dec 24, 2020
@Bound3R
Copy link

Bound3R commented Feb 13, 2021

Is it related to this problem? #486

@psw21
Copy link

psw21 commented May 21, 2021

Using keyboardShouldPersistTaps="handled" on that seems to fix it

@bell-steven
Copy link
Collaborator

This looks like this issue mentioned in the readme. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants