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

onChangeText cause flicking when is set on textInputProps #632

Closed
2 tasks done
volpejoaquin opened this issue Oct 14, 2020 · 2 comments · Fixed by #647
Closed
2 tasks done

onChangeText cause flicking when is set on textInputProps #632

volpejoaquin opened this issue Oct 14, 2020 · 2 comments · Fixed by #647
Labels

Comments

@volpejoaquin
Copy link

volpejoaquin commented Oct 14, 2020

Describe the bug

I'm using GooglePlacesAutocomplete component with textInputProps.onChangeText set. I think there is a conflict with the internal onChangeText={_handleChangeText} bind, this cause a flick on my app and doesn't work property

Reproduction

Steps to reproduce the behavior - a minimal reproducible code example, link to a snack or a repository.

<GooglePlacesAutocomplete
     minLength={3}
     fetchDetails={true}
     onPress={handlePlaceSelect}
     renderDescription={renderDescription}
     query={PLACES_QUERY}
     textInputProps={{
        onChangeText: handleChange,
        returnKeyType: "done",
      }}
     ...
 /> 

Additional context

  • Library Version: 0.2.3

  • React Native Version: 0.63.3

  • iOS

  • Android

Error

error

The problem is here:
https://github.com/FaridSafi/react-native-google-places-autocomplete/blob/master/GooglePlacesAutocomplete.js#L793

Possible fix 1

Destructure onChange prop from props.textInputProps

let {
    onFocus,
    onBlur,
    clearButtonMode,
    InputComp,
    onChangeText,
    ...userProps
  } = props.textInputProps;

HERE

Possible fix 2

Invert order of {...userProps} and onChangeText={_handleChangeText}`

  {...userProps}
  onChangeText={_handleChangeText}

HERE

Fixed

error-fixed

@bell-steven
Copy link
Collaborator

Thank for the detailed bug report. Would you mind putting in a PR?

@bell-steven bell-steven linked a pull request Nov 8, 2020 that will close this issue
@bell-steven
Copy link
Collaborator

closed by #647

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

Successfully merging a pull request may close this issue.

2 participants