Last active
February 10, 2021 01:47
-
-
Save imwilliamxy/3f815eaf55d982be0e4ac1a1fe847f62 to your computer and use it in GitHub Desktop.
react-native-dropdown-autocomplete-textinput
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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