React-native-splash-screen: support for react native 0.62.2 Auto linking

Created on 14 May 2020  Â·  6Comments  Â·  Source: crazycodeboy/react-native-splash-screen

System:
    OS: macOS 10.15.3
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 94.06 MB / 8.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.13.1 - ~/.nvm/versions/node/v12.13.1/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.12.1 - ~/.nvm/versions/node/v12.13.1/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:
      API Levels: 28, 29
      Build Tools: 28.0.3, 29.0.2
      System Images: android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 3.6 AI-192.7142.36.36.6392135
    Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_232 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: ^4.8.0 => 4.8.0
    react: 16.11.0 => 16.11.0
    react-native: 0.62.2 => 0.62.2

"react-native-splash-screen": "3.2.0"

What platform does your issue occur on? Both

Your module works perfectly fine but with this error:

error React Native CLI uses autolinking for native dependencies, but the following modules are linked manually:
  - react-native-splash-screen (to unlink run: "react-native unlink react-native-splash-screen")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>" and it will be included in your app automatically. If a library isn't compatible with autolinking, disregard this message and notify the library maintainers.
Read more about autolinking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md

You need to add support for react native 0.6+

Most helpful comment

Auto linking worked for me but on iOS only with:
react-native: 0.61.5
react-native-splash-screen: 3.2.0

Do not forget to run pod install as below. You will see the new pod being installed Installing react-native-splash-screen (3.2.0).

~/myproject$ yarn add react-native-splash-screen --save
...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ [email protected]
info All dependencies
└─ [email protected]
✨  Done in 4.89s.

~/myproject$ cd ios

~/myproject$ pod install
Detected React Native module pods for RNCAsyncStorage,...
Analyzing dependencies
Downloading dependencies
Installing react-native-splash-screen (3.2.0)
Generating Pods project
Integrating client project
Pod installation complete! There are 45 dependencies from the Podfile and 43 total pods installed.

Therefore you still have to link manually for Android which gives @ghasemikasra39 a point.

All 6 comments

@ghasemikasra39 I'm using "react-native-splash-screen": "^3.2.0" with autolinker, it works perfectly. Try to unlink this module on your project

You probably used react-native link. Auto linking is working perfectly fine.

Auto linking worked for me but on iOS only with:
react-native: 0.61.5
react-native-splash-screen: 3.2.0

Do not forget to run pod install as below. You will see the new pod being installed Installing react-native-splash-screen (3.2.0).

~/myproject$ yarn add react-native-splash-screen --save
...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
└─ [email protected]
info All dependencies
└─ [email protected]
✨  Done in 4.89s.

~/myproject$ cd ios

~/myproject$ pod install
Detected React Native module pods for RNCAsyncStorage,...
Analyzing dependencies
Downloading dependencies
Installing react-native-splash-screen (3.2.0)
Generating Pods project
Integrating client project
Pod installation complete! There are 45 dependencies from the Podfile and 43 total pods installed.

Therefore you still have to link manually for Android which gives @ghasemikasra39 a point.

For anyone else facing this issue with React Native 0.60+ auto-linking, make sure that when you ran npm i react-native-splash-screen, you also saved the dependency to the package.json file (with -S / --save or -D / --save-dev arguments).
Since RN auto-linking only works with dependencies stored in the package.json "dependencies" or "devDependencies" sections, you will get this build error if you have the package installed but not saved to the package.json file.

npx react-native link

With "react": "16.13.1", "react-native": "0.63.3", "react-native-splash-screen": "^3.2.0", I did not need to follow the second step (plugin installation), but simply step 1 and 3.

Was this page helpful?
0 / 5 - 0 ratings