Skip to content

Commit

Permalink
feat: add react-native-macos support (#513)
Browse files Browse the repository at this point in the history
* Move example -> example-prev

* Init React Native Test App

yarn init-test-app --version 0.73.0
(and manually bump react-native-* versions afterwards)

* Merge example-prev into example

* Add osx to podspec

* Fix metro config to resolve react-native-safe-area-context

* Install pods

* Write macOS equivalents for all iOS code

* Raise macOS deployment target to 10.15

* Delete example-prev

* Trying and failing to get macOS app to build

* Apply Tommy Nguyen's suggestions to fix pod installation

Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>

* Stop using compat components for macOS

* Restore example to its original state

* Add example-macos

* Reduce macOS deployment target to 10.15

* Make example-macos use RNTesterApp instead of bespoke app

* Remove example-macos

* Pin react-native and react-native-macos to v0.74

* Init react-native-macos@0.74 project

I temporarily renamed the "name" field in package.json to "RNSACExample", then ran `npx react-native-macos-init` to generate a project by that name.

* Fix bundleURL

microsoft/react-native-macos#2164 (comment)

* Fix Metro config

* Run yarn format:write

---------

Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
  • Loading branch information
shirakaba and tido64 authored Oct 31, 2024
1 parent cc52b98 commit ed16a5e
Show file tree
Hide file tree
Showing 34 changed files with 3,826 additions and 407 deletions.
476 changes: 238 additions & 238 deletions example/ios/Podfile.lock

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions example/macos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# CocoaPods
Pods/
1 change: 1 addition & 0 deletions example/macos/.xcode.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export NODE_BINARY=$(command -v node)
24 changes: 24 additions & 0 deletions example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require_relative '../node_modules/react-native-macos/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

prepare_react_native_project!

target 'RNSACExample-macOS' do
platform :macos, '10.15'
use_native_modules!

# Flags change depending on the env values.
flags = get_default_flags()

use_react_native!(
:path => '../node_modules/react-native-macos',
:hermes_enabled => false,
:fabric_enabled => ENV['RCT_NEW_ARCH_ENABLED'] == '1',
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

post_install do |installer|
react_native_post_install(installer)
end
end
Loading

0 comments on commit ed16a5e

Please sign in to comment.