Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

passing handleTextChange into react native elements custom searchbar component

$
0
0

I have this code below and I want to pass onchange={handleTextChange} in the SearchBarCustom component. But if I remove onChangeText={setValue} and add in onchange={handleTextChange} in the SearchBarCustom component, I can't type anything in the searchbar. How can I pass in the handleTextChange?

const SearchScreen = ({}: StackNavigationProps<Routes, "SearchScreen">) => {    const SearchBarCustom = (props) => {    const [value, setValue] = useState('');    return <SearchBar value={value} onChangeText={setValue} {...props} />;  };  return (<ScrollView style={styles.container} contentInsetAdjustmentBehavior='automatic' stickyHeaderIndices={[0]}><View><GoogleAutoComplete apiKey={apiKey} debounce={500} minLength={1} queryTypes={'(cities)'} >          {({ handleTextChange, locationResults}) => (<React.Fragment><View style={styles.inputWrapper}><SearchBarCustom                  containerStyle={{ backgroundColor: '#f3f2f8'}}                  inputContainerStyle={{ backgroundColor: '#e3e3e9', height: 30}}                  placeholderTextColor = '#96969b'                  placeholder="Search"                  platform="ios"                /></View><ScrollView>                {locationResults.map(el => (<LocationItem                  { ...el}                  key={el.id}                  />                ))}</ScrollView></React.Fragment>          )}</GoogleAutoComplete></View></ScrollView>    );};

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>