Skip to content

Commit

Permalink
Remove version check in FabricUtils.cpp (#3985)
Browse files Browse the repository at this point in the history
## Summary

This PR removes an outdated React Native version check when Fabric is
enabled in C++ code since there already exists such mechanism in Android
build scripts (see
[here](https://github.com/software-mansion/react-native-reanimated/blob/ef888c2cc941d5175b9ac007a237a00ea4c2593d/android/build.gradle#L595-L604)),
as well as adds an analogous check on iOS.

## Test plan

Check if FabricExample works on Android and iOS.
  • Loading branch information
tomekzaw authored Jan 20, 2023
1 parent 2d26f4c commit 26f313b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
5 changes: 0 additions & 5 deletions Common/cpp/Fabric/FabricUtils.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#ifdef RCT_NEW_ARCH_ENABLED

#if REACT_NATIVE_MINOR_VERSION < 69
#error \
"Reanimated 3 does not support React Native 0.68.x when Fabric is enabled. Please upgrade to React Native 0.69.0 or newer if you want to use Reanimated with the new architecture."
#endif

#include "FabricUtils.h"

#include <react/renderer/debug/SystraceSection.h>
Expand Down
1 change: 1 addition & 0 deletions RNReanimated.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ reanimated_package_json = JSON.parse(File.read(File.join(__dir__, "package.json"
config = find_config()
assert_no_multiple_instances(config)
assert_no_reanimated2_with_new_architecture(reanimated_package_json)
assert_latest_react_native_with_new_architecture(config, reanimated_package_json)

fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
folly_prefix = config[:react_native_minor_version] >= 64 ? 'RCT-' : ''
Expand Down
10 changes: 10 additions & 0 deletions scripts/reanimated_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,13 @@ def assert_no_reanimated2_with_new_architecture(reanimated_package_json)
raise "[react-native-reanimated] Reanimated 2.x does not support Fabric. Please upgrade to 3.x to use Reanimated with the New Architecture. For details, see https://blog.swmansion.com/announcing-reanimated-3-16167428c5f7"
end
end

def assert_latest_react_native_with_new_architecture(config, reanimated_package_json)
reanimated_version = reanimated_package_json['version']
reanimated_major_version = reanimated_version.split('.')[0].to_i
react_native_minor_version = config[:react_native_minor_version]
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
if fabric_enabled && reanimated_major_version == 3 && react_native_minor_version < 71
raise "[react-native-reanimated] Reanimated " + reanimated_version + " supports the New Architecture only on the latest minor release of React Native. Please upgrade to React Native 0.71.0+ or downgrade to an older version of Reanimated v3"
end
end

0 comments on commit 26f313b

Please sign in to comment.