crazycodeboy / react-native-splash-screen

A splash screen for react-native, hide when application loaded ,it works on iOS and Android.
MIT License
5.61k stars 1.1k forks source link

iOS splash screen not hiding when accessing native storage #465

Open lqrz opened 4 years ago

lqrz commented 4 years ago

Run react-native info in your project and share the content.

System:
    OS: macOS 10.15.2
    CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
    Memory: 445.92 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 12.15.0 - ~/.nvm/versions/node/v12.15.0/bin/node
    Yarn: 1.19.0 - /usr/local/bin/yarn
    npm: 6.13.4 - ~/.nvm/versions/node/v12.15.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
    Android SDK:
      API Levels: 26, 28
      Build Tools: 28.0.3
      System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom
  IDEs:
    Android Studio: 3.5 AI-191.8026.42.35.6010548
    Xcode: 11.3/11C29 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.9.0 => 16.9.0 
    react-native: 0.61.2 => 0.61.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1

What react-native-splash-screen version are you using?

react-native-splash-screen@3.2.0

What platform does your issue occur on?

iOS

Describe your issue as precisely as possible :

I'm calling the SplashScreen.hide() method right before accessing the device secure native storage (from secure native storage ) and, in iOS, the splash screen is never hidden (works fine on Android).

import SplashScreen from 'react-native-splash-screen';
import SecureStorage, { ACCESS_CONTROL, ACCESSIBLE, AUTHENTICATION_TYPE } from 'react-native-secure-storage';

class Init extends React.Component<IProps, IState> {

  componentDidMount() {
    // SplashScreen.hide(); // either i call it here or inside the function `checkNativeStorage(). Same result.
    this.checkNativeStorage();
  }

  async checkNativeStorage(){
    try{
      SplashScreen.hide();
      const userToken:string = await SecureStorage.getItem(...);
      ...
    }catch{ ... }
  }

}

The lib is correctly installed for both Android and iOS platforms.

Others

I'm using the following relevant dependencies:

react-native-splash-screen@3.2.0
react-native-secure-storage@0.1.2
react-native-navigation@4.8.1
kunalmhatre commented 4 years ago

@lqrz could you please try setting up IPHONEOS_DEPLOYMENT_TARGET (in project.pbxproj file) to the current version of your iOS simulator? I was facing the same issue, I found out this issue in Xcode's Buildtime log (which is when I ran the application using Xcode). And, that worked for me.

Note: There might be multiple occurrences of IPHONEOS_DEPLOYMENT_TARGET, try updating all of them. It would be much better if you check the Buildtime log before making those changes, just to get more details on the actual issue you are facing.

ghasemikasra39 commented 4 years ago

facing the same issue when using expo-secure-store. Any solution?

ghasemikasra39 commented 4 years ago

Dear @kunalmhatre Can you please explain more? I am working in bare-workflow and using expo build:ios to create ios build. Android works perfect, ios has the issue above

kunalmhatre commented 4 years ago

Hey @ghasemikasra39, actually I ran the app via Xcode and found out that IPHONEOS_DEPLOYMENT_TARGET value (in project.pbxproj file) and my current simulator version was the issue. After matching them, the issue was fixed for me. That was the native setup by the way, so I am not sure about the expo side of it, sorry. I hope you get some help on that from others. 😄

ghasemikasra39 commented 4 years ago

Dear @lqrz Do you face this issue on ios simulator as well? Because I am facing this issue only on real device, when I install the standalone ipa on my ios device. On ios simulator everything works fine.