Skip to content

Instantly share code, notes, and snippets.

@krizzu
Last active July 11, 2019 18:14
Show Gist options
  • Save krizzu/66c7f53a55029d9b971d7d4be3e09008 to your computer and use it in GitHub Desktop.
Save krizzu/66c7f53a55029d9b971d7d4be3e09008 to your computer and use it in GitHub Desktop.
How to use React as pod.

This gist will show you how to install and use React from Pods.

Podfile

target 'yourAppNameHere' 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',
    'DevSupport',
    'RCTAnimation',
    'RCTActionSheet',
    'RCTBlob',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
    # Add any other modules that You need
  ]
end

Unlink libReact.a

In Xcode, head to Build Phases of Your project. Remove 'libReact.a' from the Link Binary With Libraries. Make sure that libPods-yourAppNameHere.a is in there.

Add new React to scheme

In Xcode, select Product > Scheme > Edit Scheme On the left, Select Build Old React should be missing here, so delete it by clicking - button on the bottom. Add new React with + button, select it from Pods project Grab and move React to the top of the list.

Close and Build Your project

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment