crazycodeboy / react-native-splash-screen

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

'React/RCTBridgeModule.h' file not found #import <React/RCTBridgeModule.h> #131

Open erdemildiz opened 6 years ago

erdemildiz commented 6 years ago

I am getting this error. Somebody help me please;

`RCTSplashScreen.h:9:9: fatal error: 'React/RCTBridgeModule.h' file not found

import <React/RCTBridgeModule.h>`

It s my package.json


"dependencies": {
    "@exponent/ex-navigation": "^2.1.4",
    "@remobile/react-native-splashscreen": "^1.0.4",
    "babel-preset-react-native-stage-0": "^1.0.1",
    "eslint-plugin-react": "^6.9.0",
    "intl": "^1.2.5",
    "mobx": "^2.6.1",
    "mobx-react": "^3.5.8",
    "moment": "^2.17.1",
    "react": "^15.4.1",
    "react-hot-loader": "^1.3.1",
    "react-native": "^0.38.1",
    "react-native-facebook-login": "^1.6.0",
    "react-native-fence-html": "^1.0.6",
    "react-native-image-zoom-viewer": "^1.2.26",
    "react-native-interactions": "^0.3.1",
    "react-native-keyboard-aware-scroll-view": "^0.2.6",
    "react-native-keyboard-spacer": "^0.3.0",
    "react-native-maps": "^0.11.0",
    "react-native-network-info": "^0.2.0",
    "react-native-radio-buttons": "^0.13.0",
    "react-native-scrollable-tab-view": "^0.6.0",
    "react-native-swipe-list-view": "^0.3.1",
    "supercluster": "^2.2.0",
    "whatwg-fetch": "^2.0.2"
  },
  "jest": {
    "preset": "jest-react-native"
  },
  "devDependencies": {
    "babel-eslint": "^7.1.1",
    "babel-jest": "16.0.0",
    "babel-plugin-transform-async-generator-functions": "^6.17.0",
    "babel-preset-react-native": "^1.9.0",
    "eslint": "^3.13.1",
    "eslint-config-airbnb": "^14.0.0",
    "eslint-plugin-import": "^2.2.0",
    "eslint-plugin-jsx-a11y": "^3.0.2",
    "eslint-plugin-react": "^6.9.0",
    "eslint-plugin-react-native": "^2.2.1",
    "jest": "16.0.2",
    "jest-react-native": "16.0.0",
    "react-test-renderer": "15.3.2"
  } 
kidequinox commented 6 years ago

My issue was that various pods were using different versions of React. I needed a unified reference. Auto-removing them in the podfile fixed this issue and others.

target <yourTarget> do
 pod "yoga", :path => "../node_modules/react-native/ReactCommon/yoga"
 pod 'React', :path => '../node_modules/react-native', :subspecs => [
   'BatchedBridge', # Required For React Native 0.45.0+
   'Core',
   # Add any other subspecs you want to use in your project
 ]
end

# Remove React from projects 
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end
lee-my commented 5 years ago

ios需要用pod 不能用link(貌似新版RN都这样了) 安装完插件后,ios直接执行下面的操作,不要操作官方的步骤 cd ios/, 运行pod install下载库 然后building setting -> header search paths -> 添加 "${PODS_ROOT}/Headers/Public/react-native-splash-screen" 记得引号是英文的

AppDelegate.m添加代码 (记得官方推荐的SplashScreen.h改成RNSplashScreen.h !!)

import "RNSplashScreen.h" //引入头文件

 ...
 [self.window makeKeyAndVisible];
 [RNSplashScreen show];   // 启动后进入启动页
 return YES;
 ...

有用的记得点赞

wuweijian1997 commented 5 years ago

ios需要用pod 不能用link(貌似新版RN都这样了) 安装完插件后,ios直接执行下面的操作,不要操作官方的步骤 cd ios/, 运行pod install下载库 然后building setting -> header search paths -> 添加 "${PODS_ROOT}/Headers/Public/react-native-splash-screen" 记得引号是英文的

AppDelegate.m添加代码 (记得官方推荐的SplashScreen.h改成RNSplashScreen.h !!)

import "RNSplashScreen.h" //引入头文件

... [self.window makeKeyAndVisible]; [RNSplashScreen show]; // 启动后进入启动页 return YES; ...

有用的记得点赞

老哥强,我用教程的 header search paths路径一直是找不到RNSplashScreen.h,用这个路径就可以了

infaz commented 5 years ago

Translated version of @lee-my 's answer... Thanks for answer @lee-my Bro... (This is the correct answer)

Ios needs to use pods and can not use link (it looks like the new version of RN is like this) After installing the plugin, ios directly performs the following operations, do not operate the official steps. Cd ios/, Run pod install to download the library Then building setting -> header search paths -> add "${PODS_ROOT}/Headers/Public/react-native-splash-screen" Remember that the quotes are in English

Add code to AppDelegate.m (Remember the officially recommended SplashScreen.h changed to RNSplashScreen.h !!)

import //Introduction header file

... [self.window makeKeyAndVisible]; [RNSplashScreen show]; // Enter the startup page after startup Return YES;

GJiashuai commented 4 years ago

@lee-my 正解✅