Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Remove legacy version check in react-native.config.js #540

Merged
merged 1 commit into from
Oct 31, 2024

Conversation

lukmccall
Copy link
Contributor

Description

Removes legacy version check from react-native.config.js.

Changes

The community CLI is no longer a dependency for React Native, meaning it may not be installed in every project. For example, projects that use Expo won't include the @react-native-community/cli-* packages. Consequently, this check will fail, leading to issues with autolinking components.

This version check can be removed safely, as the 9th version of the CLI was released two years ago.

Tests

This change was tested using expo project on react native 0.76.

@janicduplessis
Copy link
Collaborator

We just released a patch that changes the default to include the config if the cli package doesn't exist, does that work? #535

@vonovak
Copy link
Contributor

vonovak commented Oct 28, 2024

@janicduplessis change from #535 works fine, thank you.

However, there's another interesting point: in many setups, until now, this setting was not considered

{
  libraryName: 'safeareacontext',
  componentDescriptors: [
    'RNCSafeAreaProviderComponentDescriptor',
    'RNCSafeAreaViewComponentDescriptor',
  ],
  cmakeListsPath: 'src/main/jni/CMakeLists.txt',
}

and it didn't seem like anything was wrong with how the safe area behaved - instead of using these custom-made files, the default ones that come with React Native were used. I'm wondering if these files are actually necessary?

@janicduplessis
Copy link
Collaborator

From what I remember it is needed because we use custom component descriptor for SafeAreaView (it has custom state class) so we need to make sure to include it (https://github.com/th3rdwave/react-native-safe-area-context/blob/main/android/src/main/jni/safeareacontext.h#L6). Not sure if autolinking is still somehow able to pick it up without that config now?

@lukmccall
Copy link
Contributor Author

The current code generation does not support custom shadow nodes. This is why you're using the interfaceOnly flag here. This flag ensures that the module's interface will be generated, but it won't be automatically linked. This is the desired behavior in this case, as it allows you to modify the shadow nodes. Additionally, when combined with react-native.config.js, it can still be linked.

tl;dr, if you are using a custom component descriptor to implement the shadow node, you cannot remove componentDescriptors from react-native.config.js

I wouldn't be concerned about backward compatibility with the CLI. The version we are checking against was published two years ago, and there are likely many other reasons why your library won't compile with React Native when paired with CLI version 9. At least, that's my personal opinion.

@janicduplessis
Copy link
Collaborator

Ok let's just remove it

@janicduplessis janicduplessis merged commit 03a2872 into AppAndFlow:main Oct 31, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants