Skip to content

Conversation

war-in
Copy link
Collaborator

@war-in war-in commented Oct 3, 2025

Details

Related Issues

GH_LINK #726

Manual Tests

Linked PRs

@war-in war-in requested a review from tomekzaw October 7, 2025 09:48
@war-in
Copy link
Collaborator Author

war-in commented Oct 8, 2025

I verified that those changes work correctly in the current E/App setup (reanimated3). Adhoc builds are here: Expensify/App#71973

I'll continue verifying the setup with reanimated v4 and worklets

@war-in
Copy link
Collaborator Author

war-in commented Oct 8, 2025

I also confirm that E/App with reanimatedv4 and react-native-worklets work fine with the code from this PR. Adhoc builds here: Expensify/App#69469 (comment)

@war-in war-in marked this pull request as ready for review October 8, 2025 09:27
Copy link

@blazejkustra blazejkustra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (mostly reviewed the js part) 👌

Comment on lines 41 to 51
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"
end
s.xcconfig = xcconfig
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work if we modify s.xcconfig directly (without xcconfig variable)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, alternatively we can just have other_cflags string variable and append to it instead of having xcconfig variable

@war-in
Copy link
Collaborator Author

war-in commented Oct 13, 2025

@tomekzaw I tested it on Expensify main and on @blazejkustra PR with reanimated bump and confirm it works as expected.

I think we're ready for merge!

tomekzaw
tomekzaw previously approved these changes Oct 14, 2025
@war-in war-in merged commit e9dc87e into Expensify:main Oct 14, 2025
7 checks passed
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the library from using react-native-reanimated to react-native-worklets while maintaining backward compatibility. The changes introduce compile-time detection of which worklets library is available and adapt the code accordingly.

  • Updates type definitions to use locally-defined worklet types instead of importing from reanimated
  • Adds conditional compilation flags and build configurations for both libraries
  • Implements backward-compatible type casting and library detection

Reviewed Changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/parseExpensiMark.ts Updates imports to use local WorkletFunction type with generic parameters
src/commonTypes.ts Adds comprehensive worklet type definitions for both libraries
src/MarkdownTextInput.tsx Updates imports and adds type casting for backward compatibility
package.json Adds react-native-worklets as optional dependency while updating reanimated version
example/package.json Updates dependency versions for both worklet libraries
example/babel.config.js Adds conditional plugin selection based on available worklets library
cpp/RuntimeDecorator.cpp Implements conditional compilation for different worklet extraction methods
cpp/MarkdownGlobal.h Adds type alias for backward compatibility with ShareableWorklet
cpp/MarkdownGlobal.cpp Updates function signatures to use SerializableWorklet type
apple/MarkdownParser.mm Adds conditional compilation for worklet type declarations
android/src/main/cpp/CMakeLists.txt Implements conditional build configuration for worklets libraries
android/build.gradle Adds worklets detection and conditional dependency management
RNLiveMarkdown.podspec Implements worklets library detection and conditional iOS configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +9 to +12
worklets_installed = system(%Q[
cd "#{Pod::Config.instance.installation_root}" &&
node -e "require.resolve('react-native-worklets/package.json')" > /dev/null 2>&1
])
Copy link

Copilot AI Oct 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The worklets_installed variable is being set twice with different logic. Line 9-12 uses system() to check if worklets can be resolved, but lines 13-14 overwrite this with a different check. This could lead to inconsistent detection results.

Suggested change
worklets_installed = system(%Q[
cd "#{Pod::Config.instance.installation_root}" &&
node -e "require.resolve('react-native-worklets/package.json')" > /dev/null 2>&1
])

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a valid comment - I forgot to remove the previous logic of calculating worklets_installed value but since it has no effect now, I'll remove it in a followup PR (where we'll remove the react-native-reanimated entirely)

@os-botify
Copy link
Contributor

os-botify bot commented Oct 14, 2025

🚀 Published to npm in 0.1.308 🎉

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.

3 participants