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

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNBootSplash' could not be found. React Native 76.4 #661

Closed
3 tasks done
Skvitthani opened this issue Dec 10, 2024 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@Skvitthani
Copy link

Before submitting a new issue

  • I tested using the latest version of the library, as the bug might be already fixed.
  • I tested using a supported version of react native.
  • I checked for possible duplicate issues, with possible answers.

Bug summary

Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'RNBootSplash' could not be found. Verify that a module by this name is registered in the native binary.

Facing the above issue on react native 0.76.4

Library version

^6.3.2

Environment info

package.json
{
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "react": "18.3.1",
    "react-native": "0.76.4",
    "react-native-bootsplash": "^6.3.2",
    "react-native-screens": "^4.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "15.0.1",
    "@react-native-community/cli-platform-android": "15.0.1",
    "@react-native-community/cli-platform-ios": "15.0.1",
    "@react-native/babel-preset": "0.76.4",
    "@react-native/eslint-config": "0.76.4",
    "@react-native/metro-config": "0.76.4",
    "@react-native/typescript-config": "0.76.4",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.3.1",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

Steps to reproduce

  1. …I just installed the package and tried to run the project on Android

Reproducible sample code

android/app/build.gradle
implementation("androidx.core:core-splashscreen:1.0.0")

AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  <uses-permission android:name="android.permission.INTERNET" />

  <application
    android:name=".MainApplication"
    android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:allowBackup="false"
    android:theme="@style/AppTheme"
    android:supportsRtl="true">
    <activity
      android:name=".MainActivity"
      android:label="@string/app_name"
      android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
      android:launchMode="singleTask"
      android:windowSoftInputMode="adjustResize"
      android:exported="true"
      android:theme="@style/BootTheme">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
  </application>
</manifest>



MainActivity.kt
package com.demoApp

import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
import android.os.Bundle
import com.zoontek.rnbootsplash.RNBootSplash

class MainActivity : ReactActivity() {

  override fun onCreate(savedInstanceState: Bundle?) {
    RNBootSplash.init(this, R.style.BootTheme) // ⬅️ initialize the splash screen
    super.onCreate(savedInstanceState) // super.onCreate(null) with react-native-screens
  }

  /**
   * Returns the name of the main component registered from JavaScript. This is used to schedule
   * rendering of the component.
   */
  override fun getMainComponentName(): String = "DemoApp"

  /**
   * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
   * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
   */
  override fun createReactActivityDelegate(): ReactActivityDelegate =
      DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}
@Skvitthani Skvitthani added the bug Something isn't working label Dec 10, 2024
@Skvitthani
Copy link
Author

import {StyleSheet, Text, View} from 'react-native';
import React, {useEffect} from 'react';
import RNBootSplash from 'react-native-bootsplash';

const App = () => {
console.log('RNBootSplash:', RNBootSplash);

useEffect(() => {
const init = async () => {};
init().finally(async () => {
await RNBootSplash.hide({fade: true, duration: 500});
});
}, []);
return (

App

);
};

export default App;

const styles = StyleSheet.create({});

Error located in App.tsx file, in the above file

@zoontek zoontek closed this as completed Dec 10, 2024
@zoontek
Copy link
Owner

zoontek commented Dec 10, 2024

Install and build it correctly. There's multiple duplicate everywhere on the internet explaining what could go wrong in your setup / what you could have missed.

@bastianpedersen
Copy link

I'm facing the same issue just by following the the repository readme. @zoontek please explain how we can fix it.

@Grohden
Copy link

Grohden commented Jan 8, 2025

Been trying to add expo into our existing app and I've been seeing these kind of issues in other repos, so I guess its more general (probably related to hermes: false + new arch: true)

react-native-clipboard/clipboard#276
react-native-share/react-native-share#1414
and this one

@zoontek
Copy link
Owner

zoontek commented Jan 8, 2025

@Grohden That's react native linking issues, not related to the libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants