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.alert without message kills apps even after refreshing #18439

Closed
thijssmudde opened this issue Mar 18, 2018 · 12 comments
Closed

Alert.alert without message kills apps even after refreshing #18439

thijssmudde opened this issue Mar 18, 2018 · 12 comments
Labels
Bug Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.

Comments

@thijssmudde
Copy link

thijssmudde commented Mar 18, 2018

Unrecognized selector sent to instance was thrown while invoking alertWithArgs on target AlertManager

image

Environment

Environment:
OS: macOS High Sierra 10.13.3
Node: 9.2.0
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.52.0 => 0.52.0

Steps to Reproduce

https://snack.expo.io/SJG9v82Kz

See: https://stackoverflow.com/questions/41942681/alert-alert-alertmanager-with-params-exception

Expected Behavior

No crash

Actual Behavior

Crash

@react-native-bot
Copy link
Collaborator

Thanks for posting this! It looks like your issue may be incomplete. Are all the fields required by the Issue Template filled out?

If you believe your issue contains all the relevant information, let us know in order to have a maintainer remove the No Template label. Thank you for your contributions.

How to ContributeWhat to Expect from Maintainers

@react-native-bot react-native-bot added No Template 📋 Ran Commands One of our bots successfully processed a command. labels Mar 18, 2018
@hramos
Copy link
Contributor

hramos commented Mar 26, 2018

Closing after seven days with no follow up from the author.

@hramos hramos closed this as completed Mar 26, 2018
@thijssmudde
Copy link
Author

thijssmudde commented Apr 1, 2018

Updated to the template. It had all useful information before tho

@LouisJS

This comment has been minimized.

@siamakEsh

This comment has been minimized.

@trev91

This comment has been minimized.

@thijssmudde
Copy link
Author

thijssmudde commented May 7, 2018

@trev91 To fix it at least supply an empty string ''

Here is a fix for the reproduction. So by adding 'Are you sure' as second parameter it works. However, that is not how it should be.

Alert.alert('Uitloggen', 'Are you sure?', [
     {
       text: 'Annuleer',
       style: 'cancel'
     }, {
       text: 'Ok',
       onPress: () => { //Go to walkthrough
         Meteor.logout()

         this
           .props
           .navigation
           .dispatch(NavigationActions.reset({
             index: 0,
             actions: [NavigationActions.navigate({routeName: 'Walkthrough'})]
           }))
       }
     }
   ], {cancelable: false})

@react-native-bot

This comment has been minimized.

@hramos hramos added Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. and removed ⏪Old Version labels Jul 18, 2018
@shamanking
Copy link

I have same issue with react-native version 0.55.2

@binaryta
Copy link
Contributor

If there is anything other than a string in the second argument, how do you issue an appropriate warning message in console.warn?

static alert(
title: ?string,
message?: ?string,
callbackOrButtons?: ?((() => void) | ButtonsArray),
type?: AlertType,
): void {

If the type is not matched with the above optional argument of alert, it is better to issue an appropriate error.

I can add error message for not matched type errror.

@Samiksha19
Copy link

Samiksha19 commented Aug 17, 2018

Alert.alert(
            '',     /*You can add title here, if you don't want to then put only quotes here*/
            '',     /*You can add message here, if you don't want to then put only quotes here*/
            [
                { text: 'Cancel', onPress: () => {}, style: 'cancel' },
                { text: 'OK', onPress: () => {
                    /* Your code goes here */
                    }
                }
            ],
        );

@ferrannp
Copy link
Contributor

ferrannp commented Mar 19, 2019

Hey, checking at your snack, you are calling Alert.alert like:

Alert.alert('Uitloggen', [
{
  text: 'Annuleer',
  style: 'cancel'
},
{
  text: 'Ok',
  onPress: () =>
  console.log('not rekt')
}
], {cancelable: false})

This is not valid as you are passing an array as a second parameter. There is not such constructor. If you do not want a message (second parameter), just pass empty string or null.

If you think we should change the API for Alert, I encourage you to write your proposal at https://github.com/react-native-community/discussions-and-proposals.

@facebook facebook locked as resolved and limited conversation to collaborators Mar 19, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Mar 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Good first issue Interested in collaborating? Take a stab at fixing one of these issues. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Ran Commands One of our bots successfully processed a command. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

10 participants