brunolemos / react-native-web-monorepo

Code sharing between iOS, Android & Web using monorepo
https://dev.to/brunolemos/tutorial-100-code-sharing-between-ios-android--web-using-react-native-web-andmonorepo-4pej
865 stars 175 forks source link

Making it work with react-native 0.63.X #57

Closed ms88privat closed 3 years ago

ms88privat commented 4 years ago

The Podfile of IOS looks different now:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'RNApp' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  target 'RNAppTests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end

target 'RNApp-tvOS' do
  # Pods for RNApp-tvOS

  target 'RNApp-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

So in order to make it work, I needed to search & replace also node_modules/@react-native-community with ../../node_modules/@react-native-community and adjust the podfile use_react_native!(:path => config["reactNativePath"])with use_react_native!(:path => './../../../node_modules/react-native/')

Hope that helps somebody else 👋

SRandazzo commented 4 years ago

Thanks this helped me! I had to make one other change per this thread: https://github.com/facebook/react-native/issues/29371

use_react_native!(:path => config[:reactNativePath])

RN version 0.63.2 Yarn workspace via lerna

sobernaut commented 4 years ago

Thanks guys! @ms88privat @SRandazzo was really stuck with this for long.

It be noted that, you have to change path to /node_modules/hermes-engine and /node_modules/jsc-android in android and android/app's build.gradle file as well. To make it work on android.

lovetofail commented 4 years ago

How do I upgrade from 0.61.4 to 0.63.2? https://react-native-community.github.io/upgrade-helper/?from=0.61.4&to=0.63.2 Using upgrade-helper looks tedious to update line by line. I suppose @brunolemos is too busy or doesn't see a point to upgrade this repository.

exzos28 commented 4 years ago

https://github.com/exzos28/react-native-web-monorepo

with rn 0.63.3

brunolemos commented 4 years ago

I'll wait for 0.64 to upgrade this repo

ecklf commented 4 years ago

I have a working setup in terms of building the app, but I am running into another problem. My web project uses react v17 and it seems there is a metro bundler / hoisting issue.

I keep getting errors with "invalid hook calls" as described here: https://github.com/facebook/react-native/issues/29722. Has anyone found a fix for this?

cauyyl commented 3 years ago

awesome, you need to pay attention at that make sure node_modules path is right

brunolemos commented 3 years ago

Hi, this repo is now updated to react-native v0.63.3 and create-react-app v4. I also added nextjs as an alternative to cra. Thanks!