React-native-google-places-autocomplete: Prop `autoFocus={true}` doesn't work

Created on 30 Jan 2018  Â·  3Comments  Â·  Source: FaridSafi/react-native-google-places-autocomplete

I tried to put this prop like true autoFocus={true} but it doesn't work on release, when I test my app on debug it works perfectly but when I tried to test it on release the autoFocus equal true doesn't works on android and iOS

Most helpful comment

Hello! This appears to still be broken on both Android and iOS. I've worked around it with this code snippet (the above didn't work either), but it still appears to be a bug:

textInputProps={{
  // Super hacky..
  ref: (textInput) => {
    setTimeout(() => textInput && textInput.focus(), 100);
  },
}}

All 3 comments

I've been working around this issue and I've found a way to make it works

<GooglePlacesAutocomplete
          placeholder={I18n.t("delivery.placeholderSearch")}
          minLength={2}
          fetchDetails={true}
          listViewDisplayed="auto"
          query={{
            key: "xxxxxxxxxxxxxxxxxxxxxxxx",
            language: "en",
            types: "geocode"
          }}
          onPress={(data, details = null) => {
            this.newCoordinates(details);
          }}
          getDefaultValue={() => this.state.keyword}
          renderLeftButton={this.renderLeftButtom}
          renderRow={this.renderRow}
          styles={styles}
          style={styles.inputSearch}
          textInputProps={{
            ref: textInput => {
              if (this.props.autofocus) {
                textInput && textInput.focus();
              }
              if (this.state.showMap) {
                textInput && textInput.blur();
              }
            }
          }}
        />

Hello! This appears to still be broken on both Android and iOS. I've worked around it with this code snippet (the above didn't work either), but it still appears to be a bug:

textInputProps={{
  // Super hacky..
  ref: (textInput) => {
    setTimeout(() => textInput && textInput.focus(), 100);
  },
}}

Hello! This appears to still be broken on both Android and iOS. I've worked around it with this code snippet (the above didn't work either), but it still appears to be a bug:

textInputProps={{
  // Super hacky..
  ref: (textInput) => {
    setTimeout(() => textInput && textInput.focus(), 100);
  },
}}

It works but I've used GooglePlacesAutocomplete in modal while setting modal visible it focus automatically but when I dismiss modal it gives me error -

Exception 'Bridge module `(null)` does not conform to RCTBridgeModule' was thrown while invoking dispatchViewManagerCommand on target UIManager with params (
    199,
    focus,
        (
    )
)

Uploading Screenshot 2020-12-18 at 7.00.05 PM.png…

Was this page helpful?
0 / 5 - 0 ratings

Related issues

quandevelopment picture quandevelopment  Â·  4Comments

miguel-pm picture miguel-pm  Â·  3Comments

yashwanth15 picture yashwanth15  Â·  3Comments

KhalilKhalaf picture KhalilKhalaf  Â·  4Comments

yasirdev picture yasirdev  Â·  3Comments