Skip to content

Commit 142ac31

Browse files
authored
Merge pull request #5712 from EdgeApp/william/reanimated4
Reanimated4
2 parents ee0263b + d595724 commit 142ac31

File tree

70 files changed

+1452
-380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1452
-380
lines changed

babel.config.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
module.exports = {
2-
presets: ['module:@react-native/babel-preset'],
3-
plugins: ['react-native-reanimated/plugin']
1+
module.exports = function (api) {
2+
const isAndroid = api.caller(c => c.platform === 'android')
3+
4+
return {
5+
presets: ['module:@react-native/babel-preset'],
6+
plugins: [
7+
isAndroid
8+
? './node_modules/r3-hack/node_modules/react-native-reanimated/plugin'
9+
: 'react-native-worklets/plugin'
10+
]
11+
}
412
}

ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ target 'edge' do
5050
:path => config[:reactNativePath],
5151
# An absolute path to your application root.
5252
:app_path => "#{Pod::Config.instance.installation_root}/..",
53-
:fabric_enabled => false,
53+
:fabric_enabled => true,
5454
:hermes_enabled => true
5555
)
5656

ios/Podfile.lock

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2320,7 +2320,7 @@ PODS:
23202320
- ZXingObjC
23212321
- RNReactNativeHapticFeedback (1.14.0):
23222322
- React-Core
2323-
- RNReanimated (3.19.0):
2323+
- RNReanimated (4.0.2):
23242324
- DoubleConversion
23252325
- glog
23262326
- hermes-engine
@@ -2343,10 +2343,10 @@ PODS:
23432343
- ReactCodegen
23442344
- ReactCommon/turbomodule/bridging
23452345
- ReactCommon/turbomodule/core
2346-
- RNReanimated/reanimated (= 3.19.0)
2347-
- RNReanimated/worklets (= 3.19.0)
2346+
- RNReanimated/reanimated (= 4.0.2)
2347+
- RNWorklets
23482348
- Yoga
2349-
- RNReanimated/reanimated (3.19.0):
2349+
- RNReanimated/reanimated (4.0.2):
23502350
- DoubleConversion
23512351
- glog
23522352
- hermes-engine
@@ -2369,9 +2369,10 @@ PODS:
23692369
- ReactCodegen
23702370
- ReactCommon/turbomodule/bridging
23712371
- ReactCommon/turbomodule/core
2372-
- RNReanimated/reanimated/apple (= 3.19.0)
2372+
- RNReanimated/reanimated/apple (= 4.0.2)
2373+
- RNWorklets
23732374
- Yoga
2374-
- RNReanimated/reanimated/apple (3.19.0):
2375+
- RNReanimated/reanimated/apple (4.0.2):
23752376
- DoubleConversion
23762377
- glog
23772378
- hermes-engine
@@ -2394,8 +2395,9 @@ PODS:
23942395
- ReactCodegen
23952396
- ReactCommon/turbomodule/bridging
23962397
- ReactCommon/turbomodule/core
2398+
- RNWorklets
23972399
- Yoga
2398-
- RNReanimated/worklets (3.19.0):
2400+
- RNScreens (4.11.1):
23992401
- DoubleConversion
24002402
- glog
24012403
- hermes-engine
@@ -2412,15 +2414,16 @@ PODS:
24122414
- React-jsi
24132415
- React-NativeModulesApple
24142416
- React-RCTFabric
2417+
- React-RCTImage
24152418
- React-renderercss
24162419
- React-rendererdebug
24172420
- React-utils
24182421
- ReactCodegen
24192422
- ReactCommon/turbomodule/bridging
24202423
- ReactCommon/turbomodule/core
2421-
- RNReanimated/worklets/apple (= 3.19.0)
2424+
- RNScreens/common (= 4.11.1)
24222425
- Yoga
2423-
- RNReanimated/worklets/apple (3.19.0):
2426+
- RNScreens/common (4.11.1):
24242427
- DoubleConversion
24252428
- glog
24262429
- hermes-engine
@@ -2437,14 +2440,17 @@ PODS:
24372440
- React-jsi
24382441
- React-NativeModulesApple
24392442
- React-RCTFabric
2443+
- React-RCTImage
24402444
- React-renderercss
24412445
- React-rendererdebug
24422446
- React-utils
24432447
- ReactCodegen
24442448
- ReactCommon/turbomodule/bridging
24452449
- ReactCommon/turbomodule/core
24462450
- Yoga
2447-
- RNScreens (4.11.1):
2451+
- RNSecureRandom (1.0.1):
2452+
- React
2453+
- RNSentry (6.14.0):
24482454
- DoubleConversion
24492455
- glog
24502456
- hermes-engine
@@ -2461,16 +2467,15 @@ PODS:
24612467
- React-jsi
24622468
- React-NativeModulesApple
24632469
- React-RCTFabric
2464-
- React-RCTImage
24652470
- React-renderercss
24662471
- React-rendererdebug
24672472
- React-utils
24682473
- ReactCodegen
24692474
- ReactCommon/turbomodule/bridging
24702475
- ReactCommon/turbomodule/core
2471-
- RNScreens/common (= 4.11.1)
2476+
- Sentry/HybridSDK (= 8.50.2)
24722477
- Yoga
2473-
- RNScreens/common (4.11.1):
2478+
- RNShare (12.0.11):
24742479
- DoubleConversion
24752480
- glog
24762481
- hermes-engine
@@ -2487,17 +2492,19 @@ PODS:
24872492
- React-jsi
24882493
- React-NativeModulesApple
24892494
- React-RCTFabric
2490-
- React-RCTImage
24912495
- React-renderercss
24922496
- React-rendererdebug
24932497
- React-utils
24942498
- ReactCodegen
24952499
- ReactCommon/turbomodule/bridging
24962500
- ReactCommon/turbomodule/core
24972501
- Yoga
2498-
- RNSecureRandom (1.0.1):
2502+
- RNSound (0.11.0):
24992503
- React
2500-
- RNSentry (6.14.0):
2504+
- RNSound/Core (= 0.11.0)
2505+
- RNSound/Core (0.11.0):
2506+
- React
2507+
- RNStoreReview (0.4.3):
25012508
- DoubleConversion
25022509
- glog
25032510
- hermes-engine
@@ -2520,9 +2527,8 @@ PODS:
25202527
- ReactCodegen
25212528
- ReactCommon/turbomodule/bridging
25222529
- ReactCommon/turbomodule/core
2523-
- Sentry/HybridSDK (= 8.50.2)
25242530
- Yoga
2525-
- RNShare (12.0.11):
2531+
- RNSVG (15.12.0):
25262532
- DoubleConversion
25272533
- glog
25282534
- hermes-engine
@@ -2545,13 +2551,9 @@ PODS:
25452551
- ReactCodegen
25462552
- ReactCommon/turbomodule/bridging
25472553
- ReactCommon/turbomodule/core
2554+
- RNSVG/common (= 15.12.0)
25482555
- Yoga
2549-
- RNSound (0.11.0):
2550-
- React
2551-
- RNSound/Core (= 0.11.0)
2552-
- RNSound/Core (0.11.0):
2553-
- React
2554-
- RNStoreReview (0.4.3):
2556+
- RNSVG/common (15.12.0):
25552557
- DoubleConversion
25562558
- glog
25572559
- hermes-engine
@@ -2575,7 +2577,7 @@ PODS:
25752577
- ReactCommon/turbomodule/bridging
25762578
- ReactCommon/turbomodule/core
25772579
- Yoga
2578-
- RNSVG (15.12.0):
2580+
- RNVectorIcons (10.1.0):
25792581
- DoubleConversion
25802582
- glog
25812583
- hermes-engine
@@ -2598,9 +2600,8 @@ PODS:
25982600
- ReactCodegen
25992601
- ReactCommon/turbomodule/bridging
26002602
- ReactCommon/turbomodule/core
2601-
- RNSVG/common (= 15.12.0)
26022603
- Yoga
2603-
- RNSVG/common (15.12.0):
2604+
- RNWorklets (0.4.1):
26042605
- DoubleConversion
26052606
- glog
26062607
- hermes-engine
@@ -2623,8 +2624,34 @@ PODS:
26232624
- ReactCodegen
26242625
- ReactCommon/turbomodule/bridging
26252626
- ReactCommon/turbomodule/core
2627+
- RNWorklets/worklets (= 0.4.1)
26262628
- Yoga
2627-
- RNVectorIcons (10.1.0):
2629+
- RNWorklets/worklets (0.4.1):
2630+
- DoubleConversion
2631+
- glog
2632+
- hermes-engine
2633+
- RCT-Folly (= 2024.11.18.00)
2634+
- RCTRequired
2635+
- RCTTypeSafety
2636+
- React-Core
2637+
- React-debug
2638+
- React-Fabric
2639+
- React-featureflags
2640+
- React-graphics
2641+
- React-hermes
2642+
- React-ImageManager
2643+
- React-jsi
2644+
- React-NativeModulesApple
2645+
- React-RCTFabric
2646+
- React-renderercss
2647+
- React-rendererdebug
2648+
- React-utils
2649+
- ReactCodegen
2650+
- ReactCommon/turbomodule/bridging
2651+
- ReactCommon/turbomodule/core
2652+
- RNWorklets/worklets/apple (= 0.4.1)
2653+
- Yoga
2654+
- RNWorklets/worklets/apple (0.4.1):
26282655
- DoubleConversion
26292656
- glog
26302657
- hermes-engine
@@ -2934,6 +2961,7 @@ DEPENDENCIES:
29342961
- RNStoreReview (from `../node_modules/react-native-store-review`)
29352962
- RNSVG (from `../node_modules/react-native-svg`)
29362963
- RNVectorIcons (from `../node_modules/react-native-vector-icons`)
2964+
- RNWorklets (from `../node_modules/react-native-worklets`)
29372965
- VisionCamera (from `../node_modules/react-native-vision-camera`)
29382966
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
29392967

@@ -3243,6 +3271,8 @@ EXTERNAL SOURCES:
32433271
:path: "../node_modules/react-native-svg"
32443272
RNVectorIcons:
32453273
:path: "../node_modules/react-native-vector-icons"
3274+
RNWorklets:
3275+
:path: "../node_modules/react-native-worklets"
32463276
VisionCamera:
32473277
:path: "../node_modules/react-native-vision-camera"
32483278
Yoga:
@@ -3392,7 +3422,7 @@ SPEC CHECKSUMS:
33923422
RNPermissions: 60b23d827dc7a4b2e347356fc20206184676637c
33933423
RNQrGenerator: 95feb09b4b2ed65f3a4afe795a20beed4b134ab5
33943424
RNReactNativeHapticFeedback: 8364333ca888b1b7ec9d2daf04b010ee5436366e
3395-
RNReanimated: 35a5a59798fe9a9a61259146be9fe8b0b602ab39
3425+
RNReanimated: 24b8a5b54c499ac783c2c299aad4712002c03bb1
33963426
RNScreens: 90b905d545a5ebbe976985702b8a39e3475727b2
33973427
RNSecureRandom: b64d263529492a6897e236a22a2c4249aa1b53dc
33983428
RNSentry: 33bc24cea8f87ab26521a9330549a82c703b5db4
@@ -3401,6 +3431,7 @@ SPEC CHECKSUMS:
34013431
RNStoreReview: 8b47d208282c23296d2466a488a8d9ca1979d79b
34023432
RNSVG: 45e3c3210465e75ab6374c9f746179e75d76ce48
34033433
RNVectorIcons: f1bc9e04b6f67ec09ea54e6f092e75a9e205c1d7
3434+
RNWorklets: 32e63979c33291a69d4d8541d4425ab91763320e
34043435
SDWebImage: a7f831e1a65eb5e285e3fb046a23fcfbf08e696d
34053436
SDWebImageWebPCoder: 908b83b6adda48effe7667cd2b7f78c897e5111d
34063437
Sentry: d95f5f3b32d01324b3e27d3c52747005302cc026
@@ -3426,6 +3457,6 @@ SPEC CHECKSUMS:
34263457
ZIPFoundation: b1f0de4eed33e74a676f76e12559ab6b75990197
34273458
ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5
34283459

3429-
PODFILE CHECKSUM: 2ab3d4f06447f2252ef672833166c9c33f3e8475
3460+
PODFILE CHECKSUM: 8c119d1d2fda8d2ceda1c186a5415d0c7473469a
34303461

34313462
COCOAPODS: 1.16.2

metro.config.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config')
22
const {
33
wrapWithReanimatedMetroConfig
44
} = require('react-native-reanimated/metro-config')
5+
const r3Paths = require('r3-hack')
56

67
const defaultConfig = getDefaultConfig(__dirname)
78
const { assetExts, sourceExts } = defaultConfig.resolver
@@ -19,6 +20,31 @@ const config = {
1920
)
2021
},
2122
resolver: {
23+
resolveRequest(context, moduleName, platform) {
24+
if (platform === 'android') {
25+
// Use Reanimated 3 on Android:
26+
const filePath = r3Paths[moduleName]
27+
if (filePath != null) {
28+
return { type: 'sourceFile', filePath }
29+
}
30+
31+
// Ensure we aren't missing any reanimated 3 -> 4 mappings:
32+
if (
33+
moduleName.startsWith('react-native-reanimated') ||
34+
moduleName.startsWith('react-native-worklets')
35+
) {
36+
console.log(
37+
`Could not find "${moduleName}". Please update r3-hack to include it.`
38+
)
39+
return { type: 'empty' }
40+
}
41+
}
42+
43+
// Otherwise use the normal Metro resolution:
44+
return context.resolveRequest(context, moduleName, platform)
45+
},
46+
47+
// From react-native-svg-transformer:
2248
assetExts: assetExts.filter(ext => ext !== 'svg'),
2349
sourceExts: [...sourceExts, 'svg']
2450
}

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"@react-native-firebase/messaging": "^20.5.0",
7878
"@react-native-picker/picker": "^2.4.0",
7979
"@react-navigation/bottom-tabs": "^6.5.4",
80-
"@react-navigation/drawer": "^6.5.8",
80+
"@react-navigation/drawer": "^6.7.2",
8181
"@react-navigation/elements": "^1.3.14",
8282
"@react-navigation/native": "^6.1.3",
8383
"@react-navigation/stack": "^6.3.12",
@@ -118,6 +118,7 @@
118118
"posthog-react-native": "^2.8.1",
119119
"prompts": "^2.4.2",
120120
"qrcode-generator": "^1.4.4",
121+
"r3-hack": "./scripts/r3-hack",
121122
"react": "19.0.0",
122123
"react-native": "0.79.2",
123124
"react-native-airship": "^0.2.12",
@@ -150,7 +151,7 @@
150151
"react-native-performance": "^5.1.4",
151152
"react-native-permissions": "^4.1.5",
152153
"react-native-piratechain": "^0.5.12",
153-
"react-native-reanimated": "^3.18.0",
154+
"react-native-reanimated": "^4.0.2",
154155
"react-native-reorderable-list": "^0.5.0",
155156
"react-native-safari-view": "^2.1.0",
156157
"react-native-safe-area-context": "^5.5.1",
@@ -165,6 +166,7 @@
165166
"react-native-vision-camera": "^4.7.1",
166167
"react-native-webview": "^13.15.0",
167168
"react-native-wheel-picker-android": "^2.0.6",
169+
"react-native-worklets": "^0.4.1",
168170
"react-native-zano": "^0.2.1",
169171
"react-native-zcash": "^0.9.10",
170172
"react-redux": "^8.1.1",
@@ -264,5 +266,10 @@
264266
},
265267
"engines": {
266268
"node": ">=18"
269+
},
270+
"reanimated": {
271+
"staticFeatureFlags": {
272+
"DISABLE_COMMIT_PAUSING_MECHANISM": true
273+
}
267274
}
268275
}

0 commit comments

Comments
 (0)