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/stripe-react-native': { 10 content: [ 11 { 12 paths: '*.m', 13 find: /RCT_EXTERN_MODULE\((ApplePayButtonManager|CardFieldManager|AuBECSDebitFormManager|StripeSdk|StripeContainerManager|CardFormManager)/, 14 replaceWith: `RCT_EXTERN_REMAP_MODULE($1, ${prefix}$1`, 15 }, 16 { 17 paths: '', 18 find: /\.reactFocus\(/, 19 replaceWith: `.${prefix.toLowerCase()}ReactFocus(`, 20 }, 21 ], 22 }, 23 'lottie-react-native': { 24 content: [ 25 { 26 paths: 'LRNAnimationViewManagerObjC.m', 27 find: /RCT_EXTERN_MODULE\(/, 28 replaceWith: `RCT_EXTERN_REMAP_MODULE(LottieAnimationView, ${prefix}`, 29 }, 30 { 31 paths: 'ContainerView.swift', 32 find: /\breactSetFrame/g, 33 replaceWith: `${prefix.toLowerCase()}ReactSetFrame`, 34 }, 35 ], 36 }, 37 'react-native-webview': { 38 content: [ 39 { 40 paths: 'RNCWebView.m', 41 find: new RegExp(`#import "objc/${prefix}runtime\\.h"`, ''), 42 replaceWith: '#import "objc/runtime.h"', 43 }, 44 { 45 paths: 'RNCWebView.m', 46 find: /\b(_SwizzleHelperWK)\b/g, 47 replaceWith: `${prefix}$1`, 48 }, 49 { 50 // see issue: https://github.com/expo/expo/issues/4463 51 paths: 'RNCWebView.m', 52 find: /MessageHandlerName = @"ABI\d+_\d+_\d+ReactNativeWebView";/, 53 replaceWith: `MessageHandlerName = @"ReactNativeWebView";`, 54 }, 55 { 56 paths: 'RNCWebView.m', 57 find: 'NSString *const CUSTOM_SELECTOR', 58 replaceWith: 'static NSString *const CUSTOM_SELECTOR', 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: new RegExp(`ReactCommon/(?!${prefix})`, '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 paths: 'REAUIManager.{h,mm}', 84 find: /(blockSetter|_toBeRemovedRegister|_parentMapper|_animationsManager|_scheduler)/g, 85 replaceWith: `${prefix}$1`, 86 }, 87 { 88 paths: 'REATransitionAnimation.m', 89 find: /(SimAnimationDragCoefficient)\(/g, 90 replaceWith: `${prefix}$1(`, 91 }, 92 { 93 paths: 'REAAnimationsManager.m', 94 find: /^(#import <.*React)\/UIView\+(.+)\.h>/gm, 95 replaceWith: `$1/${prefix}UIView+$2.h>`, 96 }, 97 { 98 paths: 'REAAnimationsManager.m', 99 find: `UIView+${prefix}React.h`, 100 replaceWith: `UIView+React.h`, 101 }, 102 ], 103 }, 104 'react-native-gesture-handler': { 105 path: [ 106 { 107 find: /\bRN(\w+?)\.(h|m|mm)/, 108 replaceWith: `${prefix}RN$1.$2`, 109 }, 110 ], 111 content: [ 112 { 113 find: `UIView+${prefix}React.h`, 114 replaceWith: `${prefix}UIView+React.h`, 115 }, 116 { 117 // `RNG*` symbols are already prefixed at this point, 118 // but there are some new symbols in RNGH that don't have "G". 119 paths: '*.{h,m}', 120 find: /\bRN(\w+?)\b/g, 121 replaceWith: `${prefix}RN$1`, 122 }, 123 ], 124 }, 125 'react-native-pager-view': { 126 path: [ 127 { 128 find: /(ReactNativePageView|ReactViewPagerManager)\.(h|m)/, 129 replaceWith: `${prefix}$1.$2`, 130 }, 131 ], 132 content: [ 133 { 134 find: `UIView+${prefix}React.h`, 135 replaceWith: `${prefix}UIView+React.h`, 136 }, 137 { 138 find: `${prefix}JKBigInteger.h`, 139 replaceWith: `JKBigInteger.h`, 140 }, 141 ], 142 }, 143 '@react-native-segmented-control/segmented-control': { 144 content: [ 145 { 146 find: `UIView+${prefix}React.h`, 147 replaceWith: `${prefix}UIView+React.h`, 148 }, 149 ], 150 }, 151 'react-native-screens': { 152 content: [], 153 }, 154 }; 155} 156