Skip to content

Instantly share code, notes, and snippets.

@imwilliamxy
Last active February 10, 2021 01:47
Show Gist options
  • Save imwilliamxy/3f815eaf55d982be0e4ac1a1fe847f62 to your computer and use it in GitHub Desktop.
Save imwilliamxy/3f815eaf55d982be0e4ac1a1fe847f62 to your computer and use it in GitHub Desktop.
react-native-dropdown-autocomplete-textinput
'use strict';
import { useNavigation } from '@react-navigation/core';
import React, { useState, useEffect, } from 'react';
import {
KeyboardAvoidingView,
ScrollView,
View,
} from 'react-native';
// import { ScrollView } from 'react-native-gesture-handler';
import { useSelector } from 'react-redux';
import Autocomplete from 'react-native-dropdown-autocomplete-textinput';
export default function App(props) {
const { userdata } = useSelector((state) => {
return {
userdata: state.userdata,
}
});
const [users, seUsers] = useState([]);
const [scrollEnabled, setScrollEnabled] = useState(true);
useEffect(() => {
setIssuerList(userdata.users);
}, [])
return (
<ScrollView
keyboardShouldPersistTaps="handled"
scrollEnabled={scrollEnabled}
onKeyboardDidShow={() => {setScrollEnabled(false)}}
onKeyboardDidHide={() => {setScrollEnabled(true)}}
>
<KeyboardAvoidingView
style={{paddingHorizontal:10}}
>
<Autocomplete
data={issuerList}
displayKey="name"
onSelect={(value)=>{console.log("select:", value)}}
placeholder={'Issuer'}
maxHeight={200}
/>
<View style={{marginTop: 200}}></View>
</KeyboardAvoidingView>
</ScrollView>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment