invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.71k stars 2.22k forks source link

🔥 Can't request OTP using auth package in iOS #5054

Closed kunalsolanki1992 closed 3 years ago

kunalsolanki1992 commented 3 years ago

Issue

I am trying to verify user's mobile number after signing them up in the application. When I install the app first time, then the captcha opens in iOS simulator and I also receive the OTP on the number entered during sign up. On trying to sign up another user, then I get this error on requesting OTP "Illegal callback invocation from native module. This callback type only permits a single invocation from native code." I am running this in iOS simulator as of now because I can't test this on device as of now.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json { "name": "CommisshReferral", "version": "0.0.1", "private": true, "scripts": { "android": "react-native run-android", "ios": "react-native run-ios", "start": "react-native start", "test": "jest", "lint": "eslint .", "react-android": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res && react-native run-android" }, "dependencies": { "@react-native-community/async-storage": "^1.10.0", "@react-native-community/masked-view": "^0.1.10", "@react-native-firebase/app": "^7.2.0", "@react-native-firebase/auth": "^8.0.4", "@twotalltotems/react-native-otp-input": "^1.3.5", "axios": "^0.19.2", "d3-scale": "^3.2.1", "moment": "^2.27.0", "native-base": "^2.13.12", "react": "16.11.0", "react-native": "0.62.2", "react-native-chart-kit": "^5.5.0", "react-native-document-picker": "^3.4.0", "react-native-gesture-handler": "^1.6.1", "react-native-image-crop-picker": "^0.30.0", "react-native-localization": "^2.1.6", "react-native-localize": "^1.4.0", "react-native-reanimated": "^1.8.0", "react-native-safe-area-context": "^0.7.3", "react-native-safe-area-view": "^1.1.1", "react-native-screens": "^2.7.0", "react-native-star-rating": "^1.1.0", "react-native-status-bar-height": "^2.5.0", "react-native-svg": "^12.1.0", "react-native-svg-charts": "^5.4.0", "react-native-webview": "^10.2.3", "react-navigation": "^4.3.9", "react-navigation-stack": "^2.4.0", "react-redux": "^7.2.0", "redux": "^4.0.5", "redux-logger": "^3.0.6", "redux-persist": "^6.0.0", "redux-thunk": "^2.3.0" }, "devDependencies": { "@babel/core": "7.9.6", "@babel/runtime": "7.9.6", "@react-native-community/eslint-config": "0.0.5", "babel-jest": "24.9.0", "eslint": "6.8.0", "jest": "24.9.0", "metro-react-native-babel-preset": "0.58.0", "react-test-renderer": "16.11.0" }, "jest": { "preset": "react-native" } } ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby platform :ios, '9.0' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' target 'CommisshReferral' do # Pods for CommisshReferral pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec' target 'CommisshReferralTests' do inherit! :complete # Pods for testing end use_native_modules! # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. # add_flipper_pods! # post_install do |installer| # flipper_post_install(installer) # end end target 'CommisshReferral-tvOS' do # Pods for CommisshReferral-tvOS target 'CommisshReferral-tvOSTests' do inherit! :search_paths # Pods for testing end end ``` #### `AppDelegate.m`: ```objc #import "AppDelegate.h" #import #import #import #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } //#if DEBUG // InitializeFlipper(application); //#endif RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"CommisshReferral" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; return YES; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"]; #endif } @end ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 10.15.7 CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz Memory: 384.21 MB / 12.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.13.1 - /usr/local/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.13.7 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.8.4 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 Android SDK: Not Found IDEs: Android Studio: 3.6 AI-192.7142.36.36.6308749 Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild Languages: Java: 11.0.5 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.11.0 => 16.11.0 react-native: 0.62.2 => 0.62.2 npmGlobalPackages: *react-native*: Not Found ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `@react-native-firebase/app 7.2.0` - **`Firebase` module(s) you're using that has the issue:** - `@react-native-firebase/auth 8.0.4` - **Are you using `TypeScript`?** - `N`


kunalsolanki1992 commented 3 years ago

I have not provided details of android platform because it works fine on android.

kunalsolanki1992 commented 3 years ago

Before getting this error I get this message in Xcode console "[Presentation] Attempt to present <SFSafariViewController: 0x7fde84918200> on <RCTModalHostViewController: 0x7fde846a1480> (from <RCTModalHostViewController: 0x7fde846a1480>) whose view is not in the window hierarchy."

and when I refresh I get "Illegal callback invocation from native module. This callback type only permits a single invocation from native code."

mikehardy commented 3 years ago

Hi there!

https://github.com/invertase/react-native-firebase/issues?q=+This+callback+type+only+permits+a+single+invocation+from+native+code.

Duplicate #https://github.com/invertase/react-native-firebase/issues/2576#issuecomment-549648883

I'm facing the same issue. For me, the issue is on iOS simulator when I try to live reload the modified code and then try to login. But if I kill the app and try again then it works fine always. Not sure how to resolve this issue. Also, I'm not able to reproduce this on an actual device.

...for phone number things (and messaging) a real device is the standard - please see if you can reproduce it there, if you can then we can reopen the original issue (not this duplicate) and investigate if you provide a minimal App.js that reproduces it

Indicentally, you should never log issues against old versions of react-native-firebase, the first thing I will ask - as I ask now - is, update to current stable versions of our modules including the firebase-ios-sdk (7.8.1 or maybe 7.9.0 is out) and see if you can reproduce - no time will be spent reproducing issues on old versions