-
Notifications
You must be signed in to change notification settings - Fork 130
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
Selected element (item) is not displayed #167
Comments
Would it possible for you to link an Expo Snack (https://snack.expo.dev/) with a reproducible example of the error you are experiencing? Then it will be easier to see out what could be causing the error. |
I have the same issue which occur only when I do a |
<ModalSelector data={data} onChange={(option) => { console.log(option) }} /> works fine but <ModalSelector data={data} onChange={(option) => { this.setState({ myvar: option.key }) } /> Don't display the selected value |
Actually when I run a setState it erase the selector |
I fixed my issue by using |
For thoose who had the same problem, but already had a selectedKey prop, on ios, if you do : go check the issue : https://github.com/peacechen/react-native-modal-selector/issues/140 and change the onChange props into onModalClose : or if you don't use the hooks |
This solution works fine to me! Thank you so much @solisoft |
Thank you so much, it works fine! |
The selected element (data: label & key) is adopted, but not displayed in the selector field.
The style properties are also not adopted!!!
The code for the selector:
<ModalSelector
data={data}
ref={selector => {this.selector = selector;}}
overlayStyle={styles.dropdownselector}
caseSensitiveSearch={true}
initValue="Bitte Artikeltyp auswählen!"
supportedOrientations={['landscape']}
accessible={true}
cancelText="zurück"
scrollViewAccessible={true}
scrollViewAccessibilityLabel={'Scrollable options'}
searchText="Suche"
searchTextStyle={{
fontFamily: 'sans-serif',
fontSize: 18,
textAlign: 'center'}}
onChange={(item)=> this.handleChange(item.label, 'itemcat') }>
Style properties:
const styles = StyleSheet.create({
...
dropdownselector: {
borderColor: 'deepskyblue',
borderRadius: 8,
borderWidth: 1,
height: 40,
padding: 10,
marginBottom: 15,
backgroundColor: '#fafafa',
},
...
The text was updated successfully, but these errors were encountered: