callstack / react-native-builder-bob

👷‍♂️ Simple set of CLIs to scaffold and build React Native libraries for different targets
https://callstack.github.io/react-native-builder-bob/
2.78k stars 184 forks source link

Backward compatibility #618

Closed Artotim closed 2 months ago

Artotim commented 2 months ago

Description

I had to create a library using an older version of React Native, so I ran the command:

npx create-react-native-library@latest --react-native-version=0.71

It worked, but I encountered two issues when running the example app:

  1. Error: project.ios.automaticPodsInstallation is not allowed

    • Solution: This is a feature from react-native 0.73, so it won't work here. I fixed this by deleting these lines in react-native.config.js:
      module.exports = {
      -    project: {
      -        ios: {
      -            automaticPodsInstallation: true,
      -        },
      -    },
       dependencies: {
           ...
  2. Error: Cannot find module '@react-native/metro-config'

    • Solution: I don't get why it's required here since I thought it was only needed after version 0.72. Anyway, I solved this by installing it as a dev dependency:
      npm install --save-dev @react-native/metro-config

I haven't tested it on iOS yet, so there might be more issues.

Would be nice to improve backward compatibility so it could prevent these errors when using an older React Native version.

Thanks.

Packages

Selected options

--react-native-version=0.71

Link to repro

Not published

Environment

OS: Windows 11 10.0.22631 CPU: (12) x64 AMD Ryzen 5 5600H with Radeon Graphics Memory: 24 GB Node: 18.20.4 Yarn: 3.6.1 npm: 10.7.0

satya164 commented 2 months ago

--react-native-version is intended for testing with newer react native versions. we officially only support the current react native version for the generated example project. you can utilize it for older react native versions if you want to, but since it's not officially supported, you're on your own to make it work. we currently don't have the bandwidth to support many react native versions simultaneously.