DEV Community

Discussion on: Tutorial: How to share code between iOS, Android & Web using React Native, react-native-web and monorepo

Collapse
 
ericlifs profile image
Eric Lifs

Thanks Bruno for this awesome post!! It was the only way I was able to make react-native work within a monorepo structure.

Currently I am working on a web + ios + tvos app and I was wondering how should I configure the tvos app since it react-native relies on npm:react-native-tvos@0.62.2-0. Following your tutorial I have:

1) Added 'react-native' and 'react-native/**' into tv package.json noHoist in order to get the react-native stored within the tv package and not use the ios hoisted one.

2) Use your metro.config.js configuration but also added the extraNodeModules in order to override the react-native alias to use the tv package one:

resolver: {
    extraNodeModules: {
      'react-native': path.resolve(__dirname, 'node_modules/react-native'),
    },
  }

3) Change the AppDelegate.m file with your configuration
4) Within the Bundle React Native code and Images section I have added the EXTRA_PACKAGER_ARGS but kept the react-native path as it is in order to use the tv package one:

export NODE_BINARY=node
export EXTRA_PACKAGER_ARGS="--entry-file packages/tv/index.js"
../node_modules/react-native/scripts/react-native-xcode.sh

Is this okay? Am I missing something else?

Thank you very much, your post is awesome <3!