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

inputValue always lags behind 1 #36

Open
karimcambridge opened this issue Mar 17, 2020 · 2 comments
Open

inputValue always lags behind 1 #36

karimcambridge opened this issue Mar 17, 2020 · 2 comments

Comments

@karimcambridge
Copy link

Can this be corrected? The passed argument is always the last value and not the current value.

@EQuimper
Copy link
Member

Should be the current value. Let me check

@karimcambridge
Copy link
Author

karimcambridge commented Mar 17, 2020

inputValue: inputValue: f inputValue: fr

image

return (
    <GoogleAutoComplete
      apiKey={GOOGLE_API_KEY_PLACES}
      debounce={300}
      minLength={data.maxTextSearchLength}
      components={`country:${country.toLowerCase()}`}
      radius={`${radius}`}
      lat={location.latitude}
      lng={location.longitude}
      queryTypes={''}
    >
      {({ inputValue, handleTextChange, locationResults, fetchDetails, isSearching }) => (
        <View
          style={{ ...styles.container, ...style }}>
          <React.Fragment>
            <View style={{ ...styles.textInputContainer, height: insets.top + 30 }}>
              <Searchbar
                placeholder='Find your destination'
                onChangeText={props => { handleTextChange(props); onSearchingUpdate(inputValue, isSearching); console.log(`inputValue: ${inputValue}`); }}
                value={inputValue}
                icon={isSearching ? () => (<ActivityIndicator animating={true} color={Colors.blueA700} />) : () => (<MaterialIcons name={iconName ? iconName : 'search'} size={24} color={iconColor ? iconColor : theme.colors.black} />)}
                onIconPress={isSearching ? null : onIconPress}
                onFocus={onFocus}
              />
            </View>
            {
              handleSearchingUpdate(inputValue, locationResults) && locationResults.length
            ?
                <ScrollView
                  style={styles.listView}
                  keyboardShouldPersistTaps='handled'
                >
                  <List.Section>
                    {locationResults.map((el, i) => (
                      <LocationItem
                        {...el}
                        fetchDetails={fetchDetails}
                        key={String(i)}
                      />
                    ))}
                  </List.Section>
                </ScrollView>
              :
                null
            }
          </React.Fragment>  
        </View>
      )}
    </GoogleAutoComplete>
  );
};

Or am I doing something wrong?

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

No branches or pull requests

2 participants