acaziasoftcom / react-native-sweet-alert

SweetAlert native module ports from native Android and iOS libraries for React Native
MIT License
53 stars 18 forks source link

Unhandled promise rejection: TypeError: undefined is not an object (evaluating 'Native.showAlertWithOptions') #9

Open metasanjaya opened 5 years ago

metasanjaya commented 5 years ago
Doko-Demo-Doa commented 5 years ago

Have you linked the module properly? And may I ask which platform did you encountered in?

metasanjaya commented 5 years ago

I follow all the steps on README, and I try it on Android

avisaxena33 commented 5 years ago

I'm getting the same issue.

khalilst commented 5 years ago

Same for me, not working according to Readme. There is no showAlert function only showAlertWithOptions and it says undefined is not an object (evaluating 'Native.showAlertWithOptions')

khalilst commented 5 years ago

I think index.js ruined in this commit.

masesisaac commented 5 years ago

Let me look into it, I will submit a PR as soon as I can

glasje commented 5 years ago

I get the following error TypeError: TypeError: undefined is not a function (near '..._reactNativeSweetAlert.default.showAlert...')

This error is located at: in AlertScreen (created by SceneView) in SceneView (at StackViewLayout.js:782) in RCTView (at View.js:44) in RCTView (at View.js:44) in RCTView (at View.js:44) in AnimatedComponent (at StackViewCard.js:69) in RCTView (at View.js:44) in AnimatedComponent (at screens.native.js:59) in Screen (at StackViewCard.js:57) in Card (at createPointerEventsContainer.js:27) in Container (at StackViewLayout.js:858) in RCTView (at View.js:44) in ScreenContainer (at StackViewLayout.js:311) in RCTView (at View.js:44) in AnimatedComponent (at StackViewLayout.js:307) in Handler (at StackViewLayout.js:300) in StackViewLayout (at withOrientation.js:30) in withOrientation (at StackView.js:79) in RCTView (at View.js:44) in Transitioner (at StackView.js:22) in StackView (created by Navigator) in Navigator (at createKeyboardAwareNavigator.js:12) in KeyboardAwareNavigator (created by SceneView) in SceneView (at createTabNavigator.js:39) in RCTView (at View.js:44) in RCTView (at View.js:44) in ResourceSavingScene (at createBottomTabNavigator.js:113) in RCTView (at View.js:44) in ScreenContainer (at createBottomTabNavigator.js:103) in RCTView (at View.js:44) in TabNavigationView (at createTabNavigator.js:197) in NavigationView (created by Navigator) in Navigator (created by SceneView) in SceneView (created by SwitchView) in SwitchView (created by Navigator) in Navigator (at createAppContainer.js:388) in NavigationContainer (at App.js:29) in RCTView (at View.js:44) in App (at withExpoRoot.js:22) in RootErrorBoundary (at withExpoRoot.js:21) in ExpoRootComponent (at renderApplication.js:34) in RCTView (at View.js:44) in RCTView (at View.js:44) in AppContainer (at renderApplication.js:33)

This error is located at: in NavigationContainer (at App.js:29) in RCTView (at View.js:44) in App (at withExpoRoot.js:22) in RootErrorBoundary (at withExpoRoot.js:21) in ExpoRootComponent (at renderApplication.js:34) in RCTView (at View.js:44) in RCTView (at View.js:44) in AppContainer (at renderApplication.js:33)

I am using expo and physical phone with android

Doko-Demo-Doa commented 5 years ago

Hello @metasanjaya Thanks for using the library. There was a mistake in README file, I have updated it.

This library might not work with Expo since it requires native module linking.

khalilst commented 5 years ago

@Doko-Demo-Doa The library doesn't work without Expo also. I've created an app with react-native and after installing and linking it wasn't worked.

metasanjaya commented 5 years ago

@Doko-Demo-Doa The library doesn't work without Expo also. I've created an app with react-native and after installing and linking it wasn't worked.

That's right.. I've created with react-native, not expo...

And done react-native link as well...

Doko-Demo-Doa commented 5 years ago

Have you tried SweetAlert.showAlertWithOptions instead of SweetAlert.showAlert? I have updated the doc as well.

This is my retry on newly created project:

Test

metasanjaya commented 5 years ago
screenshot 2019-01-30 at 4 49 36 pm

This is the screenshot, you can check the code here

https://github.com/metasanjaya/sweet-alert-react-native-example

Thank you

Doko-Demo-Doa commented 5 years ago

Oh I see, the code is a bit broken on Android due to the previous PR. I will re-check and update it ASAP.

glasje commented 5 years ago

@Doko-Demo-Doa Can you share the repo of the project you created? It would be very helpful since I need to use the library

Doko-Demo-Doa commented 5 years ago

It is in the source code in this repo itself. The only problem is wrong method name.

khalilst commented 5 years ago

@Doko-Demo-Doa No, it is not the only problem. It doesn't work with showAlertWithOptions. I have the same issue like @metasanjaya .

metasanjaya commented 5 years ago

Hello, any updates?

khalilst commented 5 years ago

@metasanjaya I've started to create my own RN.SweetAlert

metasanjaya commented 5 years ago

@metasanjaya I've started to create my own RN.SweetAlert

Can you share the code?

Thank you

khalilst commented 5 years ago

@metasanjaya Yes, I'll do. Just too busy these days. ASAP I've put it in npm.

sajjadintel commented 5 years ago

I fixed this issue and created a pull request

glasje commented 5 years ago

image I still have the same problem ... I'm not using expo-cli upload the solution? if not to rule out this npm

daytch commented 3 years ago

any update on thhis case ? i have same trouble

dxku commented 2 years ago

For anyone reading this, I just had the same problem. You have to recompile the app (at least on android) in order to make it work. (:

react-native run-android