-
Notifications
You must be signed in to change notification settings - Fork 99
Migrate from react-native-reanimated to react-native-worklets with backward compatibility
#731
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
Changes from 19 commits
1ab9b13
a3f46db
bbb432a
40b237c
e77ccf3
864ab7c
52d57be
8136e19
0fd3c5f
3a79358
49b7213
8c55455
2e125b8
955060b
d5134ad
1e3ab8b
423312b
a8a5765
ad71c95
15c34d5
a1b25f6
7f50fee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,8 +5,16 @@ react_native_json = JSON.parse(File.read(File.join(react_native_node_modules_dir | |
| react_native_minor_version = react_native_json['version'].split('.')[1].to_i | ||
|
|
||
| pods_root = Pod::Config.instance.project_pods_root | ||
| react_native_reanimated_node_modules_dir = ENV['REACT_NATIVE_REANIMATED_NODE_MODULES_DIR'] || File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native-reanimated/package.json')"`) | ||
| react_native_reanimated_node_modules_dir_from_pods_root = Pathname.new(react_native_reanimated_node_modules_dir).relative_path_from(pods_root).to_s | ||
|
|
||
| worklets_installed = system(%Q[ | ||
| cd "#{Pod::Config.instance.installation_root}" && | ||
| node -e "require.resolve('react-native-worklets/package.json')" > /dev/null 2>&1 | ||
| ]) | ||
war-in marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| package_name = worklets_installed ? 'react-native-worklets/package.json' : 'react-native-reanimated/package.json' | ||
war-in marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| react_native_worklets_node_modules_dir = ENV['REACT_NATIVE_REANIMATED_NODE_MODULES_DIR'] || | ||
war-in marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('#{package_name}')"`) | ||
war-in marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| react_native_worklets_node_modules_dir_from_pods_root = Pathname.new(react_native_worklets_node_modules_dir).relative_path_from(pods_root).to_s | ||
war-in marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| package = JSON.parse(File.read(File.join(__dir__, "package.json"))) | ||
| folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' | ||
|
|
@@ -24,15 +32,23 @@ Pod::Spec.new do |s| | |
|
|
||
| s.source_files = "apple/**/*.{h,m,mm}", "cpp/**/*.{h,cpp}" | ||
|
|
||
| s.dependency "RNReanimated/worklets" | ||
| if worklets_installed | ||
| s.dependency "RNWorklets" | ||
| else | ||
| s.dependency "RNReanimated/worklets" | ||
| end | ||
|
|
||
| s.xcconfig = { | ||
| xcconfig = { | ||
| "OTHER_CFLAGS" => "$(inherited) -DREACT_NATIVE_MINOR_VERSION=#{react_native_minor_version}", | ||
| "HEADER_SEARCH_PATHS" => [ | ||
| "\"$(PODS_ROOT)/#{react_native_reanimated_node_modules_dir_from_pods_root}/apple\"", | ||
| "\"$(PODS_ROOT)/#{react_native_reanimated_node_modules_dir_from_pods_root}/Common/cpp\"", | ||
| "\"$(PODS_ROOT)/#{react_native_worklets_node_modules_dir_from_pods_root}/apple\"", | ||
| "\"$(PODS_ROOT)/#{react_native_worklets_node_modules_dir_from_pods_root}/Common/cpp\"", | ||
| ].join(' '), | ||
| } | ||
| if worklets_installed | ||
| xcconfig["OTHER_CFLAGS"] << " -DWORKLETS_INSTALLED=1" | ||
tomekzaw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| end | ||
| s.xcconfig = xcconfig | ||
|
Comment on lines
43
to
53
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it work if we modify
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately not, I tried that at first but there was an error about modifying s.xcconfig
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, alternatively we can just have |
||
|
|
||
| s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/cpp\"" } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.