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

AndroidSuccessTypes is undefined #89

Open
aminmeshk opened this issue Sep 20, 2020 · 2 comments
Open

AndroidSuccessTypes is undefined #89

aminmeshk opened this issue Sep 20, 2020 · 2 comments

Comments

@aminmeshk
Copy link

aminmeshk commented Sep 20, 2020

I'm using React Native v0.63.2, TypeScript v4.0.2, react-native-sms v1.11.0
When I want to call this method with AndroidSuccessTypes for successTypes, it gives runtime error:

import SendSMS, { AndroidSuccessTypes } from 'react-native-sms';

SendSMS.send(
      {
        body: 'Hello World!',
        recipients: ['01234567890'],
        successTypes: [AndroidSuccessTypes.sent, AndroidSuccessTypes.queued],
        allowAndroidSendWithoutReadPermission: true,
      },
      sendSmsCompletedHandler,
    );

[Sun Sep 20 2020 09:32:02.246] ERROR TypeError: Cannot read property 'sent' of undefined, js engine: hermes

And when I log the AndroidSuccessTypes , it is actually undefined:
console.log(AndroidSuccessTypes);
Output:
[Sun Sep 20 2020 09:45:56.101] LOG undefined

@mumersaleem
Copy link

Anyone else having the exact same problem? AndroidSuccessTypes is defined in module but when imported, is undefined.

@janne
Copy link

janne commented Feb 24, 2021

It's due to that the AndroidSuccessTypes enum is exported from the index.d.ts, which doesn't seem to work. Something like this should work:

SendSMS.send({successTypes: ['sent', 'queued'] as AndroidSuccessTypes[]})

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

3 participants