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

ModalSelector reset when close modal #179

Open
EloiseIncrociati opened this issue Sep 22, 2022 · 0 comments
Open

ModalSelector reset when close modal #179

EloiseIncrociati opened this issue Sep 22, 2022 · 0 comments

Comments

@EloiseIncrociati
Copy link

EloiseIncrociati commented Sep 22, 2022

I have a component in my react native app that use a ModalSelector to choose option of type I want. If option A, it shows a button which open a modal to select a date with library react-native-calendars.
When I close the modal without validate the dates I picked, the option in modal selector stay. But if I validate, ModalSelector reset and show my text 'select a type' (initValue) of my ModalSelector. It keep in memory the choice, but didn't show it in ModalSelector.

My ModalSelector at beginning :

                <ModalSelector
                  style={{marginBottom: 15}}
                  optionContainerStyle={{backgroundColor: '#FFFFFF'}}
                  optionTextStyle={{color: '#89559e', fontWeight: 'bold'}}
                  selectTextStyle={{color: '#89559e', fontWeight: '500'}}
                  data={listAbs}
                  initValue={I18n.t(
                    'message.myapp.action.selectionnerType',
                  )}
                  cancelText={I18n.t('message.myapp.action.annuler')}
                  keyExtractor={(item) => item.code}
                  labelExtractor={(item) => item.params.libelle}
                  onChange={(option) => setCodeAbs(option)}
                />

Capture d’écran 2022-09-22 à 10 45 54

If validate the date, go back to this point and didn't keep the option. The result I want :
Capture d’écran 2022-09-22 à 10 50 23
What I have :
Capture d’écran 2022-09-22 à 10 56 31

=> I have the problem because the component was too long, so I dispatch it in different components, the component calendar picker was in another component, and the modal in the parent component. If I put my calendar picker component into the parent component, I dont have the problem I describe here. But its a problem I dont have with the children component selectFile, and same problem with children component select hours which use react-native-calendars too.

The filepicker close itself, we can see the same problem with a react native Alert. When we close it, modal selector reset. Seems it reset when we close modals, but not all modals, i dont understand.

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

1 participant