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

Alert used inside of react-native-modal-selector is being hidden while Modal Closes #165

Open
Muirik opened this issue Jul 23, 2021 · 0 comments

Comments

@Muirik
Copy link

Muirik commented Jul 23, 2021

After updating my react-native expo app to SDK 42 I am noticing that the alert used inside of react-native-modal-selector is being hidden immediately, before the user has time to act. This only occurs in iOS - not on Android. I am using version 2.0.7 of react-native-modal-selector.

Specifically, I need the alert to remain open until the user has pushed one of the two buttons to make a selection. Right now if I navigate to a different tab I see that the alert is still open and visible, but within the tab where I first open the alert it disappears before the user has a chance to make a selection.

    <ModalSelector
      data={showSessionTypes(props.types)}
      onChange={async (option) => {
        if(
          RESTRICTED_SESSION_TYPES.includes(option.customKey) &&
          props.restrictedSessions.length > 0
        ) {
          Alert.alert(
            'Session already conducted',
            'Please ensure you are accessing the correct client.',
            [
              {
                text: 'OK',
                onPress: () => {},
                style: 'cancel',
              },
            ],
            {cancelable: false},
          );
          return;
        }
    />

NOTE: If I wrap the alert in a setTimeout the alert remains open/visible:

    setTimeout(() => {
       Alert.alert(
        'Session already conducted',
        'Please ensure you are accessing the correct client.',
         [
           {
             text: 'Cancel',
             onPress: () => {},
             style: 'cancel',
           },
           {
             text: 'Create Session',
             onPress: async () => {
               await createSession(option.customKey, props);
             },
           },
         ],
         {cancelable: false},
       );
     }, 510);

If this bug is unresolvable, is there an event I can wait for before loading the alert?

@Muirik Muirik changed the title Alert used inside of react-native-modal-selector is closing immediately Alert used inside of react-native-modal-selector is being hidden while Modal Closes Jul 26, 2021
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