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

Error when import the package #30

Closed
mghifariyusuf opened this issue Apr 20, 2018 · 5 comments
Closed

Error when import the package #30

mghifariyusuf opened this issue Apr 20, 2018 · 5 comments

Comments

@mghifariyusuf
Copy link

I am just do import Swal from 'sweetalert2';
and there's error with this message:

undefined is not a function (evaluating 'Object.setPrototypeOf(NoNewKeywordSwal, ParentSwal)')

so what happens?

@zenflow
Copy link
Member

zenflow commented Apr 22, 2018

Hi @mghifariy I think this is an issue for the core repo, probably related to sweetalert2/sweetalert2#1062 which is in sweetalert2 v7.19.1 .. Try upgrading and if it's still malfunctioning open an issue in the sweetalert2 repo

@zenflow zenflow closed this as completed Apr 22, 2018
@limonte
Copy link
Member

limonte commented Apr 23, 2018

I'm not sure that

undefined is not a function (evaluating 'Object.setPrototypeOf(NoNewKeywordSwal, ParentSwal)')

when doing import Swal from 'sweetalert2' is related to sweetalert2/sweetalert2#1062

sweetalert2/sweetalert2#1062 is related only to .min.js files, and import Swal from 'sweetalert2' is using dist/sweetalert2.all.js, https://github.com/sweetalert2/sweetalert2/blob/master/package.json#L7

Just to confirm, @mghifariy do you still have that issue after upgrading to v7.19.1?

@mghifariyusuf
Copy link
Author

@limonte I'm not sure if I installed it correctly. I want to use this package for react native app. Is the installation and usage same as web? In this repo you just give an example code

@limonte
Copy link
Member

limonte commented Apr 23, 2018

@mghifariy sorry about that, this repo is relatively young and we didn't yet add the installation guide.

The installation is:

npm install --save sweetalert2 sweetalert2-react-content

I added the corresponding PR: #31

@zenflow
Copy link
Member

zenflow commented Apr 23, 2018

Seems like we're still confusing this package and the core sweetalert2 package. The problem according to the original issue is that importing sweetalert2 throws this error, which I think is correct since sweetalert2-react-content doesn't have that code with the NoNewKeywordSwal.. sweetalert2 does. And that repo has lots of documentation for how to install.

@mghifariy I can tell you that any library that interacts with the dom, like sweetalert2, will not work in react native because there there is no dom there. If you want to be able to use everything from the web in your mobile app you should read about phonegap but be aware that the User eXperience is not the same as a true native mobile app that uses the native UI like React Native does.

Still the error is unexpected and concerning, and we would greatly appreciate some more details on the environment where this error happens.. would you be able to share a repo or a codepen or codesandbox @mghifariy ? Either here or in a new issue in the sweetalert2 repo?

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