Duplicate interface definition for class ‘RCTView’

I follow the following steps to do step by step, but it can not be compiled successfully.

$ react-native init HelloWorld && cd HelloWorld

$ npm install --save @shoutem/ui

$ react-native link

$ react-native run-ios

2017-01-19 10 46 30-min

Build Environment:
Xcode: Version 8.2.1 (8C1002)
react-native”: “0.40.0”
node: v6.3.1
npm: 3.10.3

Is it because shoutem-ui does not support react-native 0.40.0 yet ?

2 thoughts on “Duplicate interface definition for class ‘RCTView’

  1. Solution Found

    1. Open your project in xcode and navigate to libraries/BVLinearGradient.xcodeproj/BVLinearGradient

    2. In each of the four files within that directory, you need to change a few import statements at the top of the file. Look for input statements with a prefix of RCT like:

    #import "RCTBridge.h"
    #import "RCTViewManager.h"
    #import "RCTView.h"
    
    1. Now change each of those statements to this:
    #import <React/RCTBridge.h>
    #import <React/RCTViewManager.h>
    #import <React/RCTView.h>
    

    Moving forward you may discover that other libraries are giving you issues like this. Until these libraries are updated to work with the latest 0.40 release of react native, you’ll have to continue with workarounds like this.

    Simply put, you just need to reformat import statements for libraries prefixed with RCT from being enclosed like this: "{library name}"
    To being enclosed like this: <React/{library name} >

    This fix should work for most other issues related to these breaking changes that came with 0.40. Version 4.0 of react-native-vector-icons and the latest version of react-native-share also fixed some issues that Shoutem/UI is currently facing. Just waiting on them to roll out a new update that includes these latest updates.

  2. Also, if you get a similar error in relation to the vector icons library. Thanks to the solution above, find the RNVectorIcons.xcodeproj/RNVectorIconsManager/RNVectorIconsManager.h, and replace:

    #import "RCTLog.h"

    with

    #import <React/RCTLog.h>

    Thanks, @tedjames