react-native-maps: 'React/RCTView.h' file not found

Is this a bug report?

No

Have you read the Installation Instructions?

Yes

Environment

react: 16.2.0 react-native: 0.52.2 react-native-maps: 0.19.0 I’m using AppleMaps

Steps to Reproduce

I’ve just install react-native-maps into my project by following Installation instructions. Without react-native link usage.

Expected Behavior

Working maps.

Actual Behavior

I get error in xcode: 'React/RCTView.h' file not found. By search in issues I find that I have to change:

AIRMap.h line 12
From #import <React/RCTComponent.h>
To #import "RCTComponent.h"

and

AIRMapCallout.h line 7
From #import "React/RCTView.h"
To #import "RCTView.h"

And all should be fine, but I get the next one error: 'React/RCTBorderStyle.h' file not found.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 4
  • Comments: 30 (1 by maintainers)

Most upvoted comments

@helixbass thanks for pointing out that I might be mistaken. I went back to look at my project that was working even with use_frameworks uncommented. Since it was a few months ago that I installed react-native-maps I forgot that I actually used the “manual” installation method that was listed in that version’s docs. It doesn’t solve this particular problem, but I was able to start a project using a Podfile with use_frameworks (I’m using FBSDK, so I need it) and then install RN Maps manually. I hope this helps anyone needing to get past this issue while it’s being solved properly.

  1. Open your project in Xcode, right click on Libraries and click Add Files to "Your Project Name" Look under node_modules/react-native-maps/lib/ios and add AIRMaps.xcodeproj.
  2. Add libAIRMaps.a to `Build Phases -> Link Binary With Libraries.
  3. Click on AIRMaps.xcodeproj in Libraries and go the Build Settings tab. Double click the text to the right of Header Search Paths and verify that it has $(SRCROOT)/../../react-native/React as well as $(SRCROOT)/../../react-native/Libraries/Image - if they aren’t, then add them. This is so Xcode is able to find the headers that the AIRMaps source files are referring to by pointing to the header files installed within the react-native node_modules directory.
  4. Whenever you want to use it within React code now you can: var MapView = require('react-native-maps');

+1 Having the same issue as above Though mine is importing the React/UIView+React.h module

I can confirm that if you start a fresh project, react-native-maps works, but once you include use_frameworks, runs into the issues stated above

My podfile looks like this:

# Uncomment the next line to define a global platform for your project
platform :ios, '8.0'

target 'mapTest' do
  use_frameworks!
  pod 'Fabric'
  pod 'Crashlytics'

  rn_path = '../node_modules/react-native'
  rn_maps_path = '../node_modules/react-native-maps'

  pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: rn_path, subspecs: [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
    'BatchedBridge'
  ]

  pod 'react-native-maps', path: rn_maps_path

  pod 'GoogleMaps'  # Remove this line if you don't want to support Google Maps on iOS
  pod 'react-native-google-maps', path: rn_maps_path  # Remove this line if you don't want to support Google Maps on iOS
end

pre_install do |installer|
	Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {}
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
    if target.name == "React"
      target.remove_from_project
    end
  end
end

Below are the errors that appear in XCode after pod install with podfile above screen shot 2018-02-09 at 10 42 57 am

sudo rm -rf node_modules && yarn cache clean && yarn install && cd ios && pod deintegrate && pod install && cd …

that always works for me, I set it on package.json inside scripts, for example: “reinstall_force”: “sudo rm -rf node_modules && yarn cache clean && yarn install && cd ios && pod deintegrate && pod install && cd …”,

then just on terminal run: yarn reinstall_force

@rborn I am facing this issue in AIRMapCallout.h file

I can’t delete use_frameworks as I am using charts as a dependency that uses swift.

Please see my pod file:

use_frameworks!

target 'DelGate' do
  pod 'SwiftyJSON', '3.1.4'      # 4.0.0
  pod 'Charts', '3.0.3'          # 3.1.1
  pod 'react-native-video', :path => '../node_modules/react-native-video'

  rn_path = '../node_modules/react-native'
  rn_maps_path = '../node_modules/react-native-maps'

  # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies
  pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: rn_path, subspecs: [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket',
  ]

  # React Native third party dependencies podspecs
  pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
  pod 'GLog', :podspec => "#{rn_path}/third-party-podspecs/GLog.podspec"
  
  pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"

  # react-native-maps dependencies
  pod 'react-native-maps', path: rn_maps_path

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'    # 4.0
    end
    if target.name == 'react-native-google-maps'
      target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
      end
    end
    if target.name == "React"
      target.remove_from_project
    end
  end
end

I rolled back to another point in my project where I was using RN Maps 0.18.3 and even though I had use_frameworks uncommented in that version of the Podfile everything worked. It’s only when I upgraded to 0.19.0 that this became a problem.

@sabbyt54, did you found the solution ?