1import { FileTransforms } from '../../../Transforms.types'; 2 3type Config = { 4 [key: string]: FileTransforms; 5}; 6 7export default function vendoredModulesTransformsFactory(prefix: string): Config { 8 return { 9 'stripe-react-native': { 10 content: [ 11 { 12 paths: 'ApplePayButtonManager.m', 13 find: /RCT_EXTERN_MODULE\(/, 14 replaceWith: `RCT_EXTERN_REMAP_MODULE(ApplePayButtonManager, ${prefix}`, 15 }, 16 { 17 paths: 'CardFieldManager.m', 18 find: /RCT_EXTERN_MODULE\(/, 19 replaceWith: `RCT_EXTERN_REMAP_MODULE(CardFieldManager, ${prefix}`, 20 }, 21 { 22 paths: 'AuBECSDebitFormManager.m', 23 find: /RCT_EXTERN_MODULE\(/, 24 replaceWith: `RCT_EXTERN_REMAP_MODULE(AuBECSDebitFormManager, ${prefix}`, 25 }, 26 ], 27 }, 28 'lottie-react-native': { 29 content: [ 30 { 31 paths: 'LRNAnimationViewManagerObjC.m', 32 find: /RCT_EXTERN_MODULE\(/, 33 replaceWith: `RCT_EXTERN_REMAP_MODULE(LottieAnimationView, ${prefix}`, 34 }, 35 { 36 paths: 'ContainerView.swift', 37 find: /\breactSetFrame/g, 38 replaceWith: `${prefix.toLowerCase()}ReactSetFrame`, 39 }, 40 ], 41 }, 42 'react-native-webview': { 43 content: [ 44 { 45 paths: 'RNCWebView.m', 46 find: new RegExp(`#import "objc/${prefix}runtime\\.h"`, ''), 47 replaceWith: '#import "objc/runtime.h"', 48 }, 49 { 50 paths: 'RNCWebView.m', 51 find: /\b(_SwizzleHelperWK)\b/g, 52 replaceWith: `${prefix}$1`, 53 }, 54 { 55 // see issue: https://github.com/expo/expo/issues/4463 56 paths: 'RNCWebView.m', 57 find: /MessageHandlerName = @"ABI\d+_\d+_\d+ReactNativeWebView";/, 58 replaceWith: `MessageHandlerName = @"ReactNativeWebView";`, 59 }, 60 ], 61 }, 62 'react-native-reanimated': { 63 content: [ 64 { 65 find: 'namespace reanimated', 66 replaceWith: `namespace ${prefix}reanimated`, 67 }, 68 { 69 find: /\breanimated::/g, 70 replaceWith: `${prefix}reanimated::`, 71 }, 72 { 73 paths: '*.h', 74 find: /ReactCommon\//g, 75 replaceWith: `ReactCommon/${prefix}`, 76 }, 77 { 78 paths: '**/Transitioning/*.m', 79 find: `RCTConvert+${prefix}REATransition.h`, 80 replaceWith: 'RCTConvert+REATransition.h', 81 }, 82 { 83 find: /(_bridge_reanimated)/g, 84 replaceWith: `${prefix}$1`, 85 }, 86 { 87 paths: 'REATransitionAnimation.m', 88 find: /(SimAnimationDragCoefficient)\(/g, 89 replaceWith: `${prefix}$1(`, 90 }, 91 ], 92 }, 93 'react-native-gesture-handler': { 94 path: [ 95 { 96 find: /Handlers\/RN(\w+)Handler\.(h|m)/, 97 replaceWith: `Handlers/${prefix}RN$1Handler.$2`, 98 }, 99 ], 100 content: [ 101 { 102 find: `UIView+${prefix}React.h`, 103 replaceWith: `${prefix}UIView+React.h`, 104 }, 105 { 106 paths: '*.{h,m}', 107 find: /\bRN(\w+)(Handler|GestureRecognizer)\b/g, 108 replaceWith: `${prefix}RN$1$2`, 109 }, 110 ], 111 }, 112 'react-native-screens': { 113 content: [], 114 }, 115 }; 116} 117