Code Monkey home page Code Monkey logo

react-native-m1's Introduction

react-native 0.64.2 with Apple M1 and Xcode 12.5

This is how I got react-native to compile on Apple Silicon without rosetta.

Clean Caches

$ pod cache clean --all
$ yarn cache clean
$ rm -rf ~/Library/Developer/Xcode/DerivedData/*

Create Project

$ npx [email protected] init MyApp
$ cd MyApp
$ open ios/MyApp.xcworkspace

Configure XCode

(Make sure to be working in the .xcworkspace not the .xcodeproj)

MyApp -> Info -> iOS Deployment Target: set to 12.1

MyApp -> Build Settings -> Architectures -> Excluded Architectures: set to arm64

MyApp -> Build Settings -> Library Search Paths: remove all of them.

Should look like this when you're done:

Next create an empty "BridgingFile.swift" to get XCode to do swift bridging.

  • File -> New -> File...
  • Call it "BridgingFile.swift"
  • Choose "Create Bridging Header"
  • (File can remain empty)

Now edit MyApp/ios/Podfile

Change the platform line to:

platform :ios, '12.1'

Replace use_flipper!() and post_install (lines 24-28) with:

  use_flipper!({ 'Flipper' => '0.95.0', 'Flipper-Folly' => '2.6.7', 'Flipper-DoubleConversion' => '3.1.7' })
  post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.1'
    end
    react_native_post_install(installer)
  end

Rebuild Pods

$ cd ios
$ rm -rf Pods Podfile.lock
$ rm -rf ~/Library/Developer/Xcode/DerivedData/*
$ pod deintegrate && pod setup && pod install

The XCode Project should now compile and run.

References:

react-native-m1's People

Contributors

aiba avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.