Joseph
Joseph

Reputation: 43

React-Native with macos target

Trying to create a NEW project which targets -both- macos and ios/android seems to fail.

Steps:

  1. Followed steps on react native website, using create-react-native-app to get a native application. It works fine.
  2. Use react-native-macos init and macos to get the mac app - it also works fine.
  3. Noticing that #1 uses an App.js and #2 uses some sort of index.platform.js model, I change the xcode project in #2 to look for App.js instead. This at least makes sure the same code is reached.
  4. As the react-native-macos github page says to do, I merge #2 into #1.. (unclear whether should overwriting, used 'ditto' command)
  5. Add the rn-cli.config.js file to root, as react-native-macos says to do
  6. Missing modules when I try to run macos - fails to bundle.

It looks to me like the 'react-native' folder in the node modules is somehow screwing up the react-native-macos folder. I'm still trying a variety of things but it's been exhausting considering how easy 'merge into your existing project' sounds.

https://github.com/ptmt/react-native-macos <- what i want to merge in

Upvotes: 1

Views: 986

Answers (1)

rmevans9
rmevans9

Reputation: 5643

You likely will not be able to use create-react-native-app and react-native-macos together without some trail and error. This is because create-react-native-app actually creates an Expo app which is built on top of react-native but tries to abstract away a lot of the native details from the end user. For example you can't use any native modules that are not shipped with Expo when using create-react-native-app. The documentation of react-native-macos is likely assuming you are using react-native init which creates a base react-native project that you have to handle building on your own instead of offloading the build process to Expo.

Upvotes: 3

Related Questions