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 }, 57 'react-native-reanimated': { 58 content: [ 59 { 60 find: 'namespace reanimated', 61 replaceWith: `namespace ${prefix}reanimated`, 62 }, 63 { 64 find: /\breanimated::/g, 65 replaceWith: `${prefix}reanimated::`, 66 }, 67 { 68 paths: '*.h', 69 find: /ReactCommon\//g, 70 replaceWith: `ReactCommon/${prefix}`, 71 }, 72 { 73 paths: '**/Transitioning/*.m', 74 find: `RCTConvert+${prefix}REATransition.h`, 75 replaceWith: 'RCTConvert+REATransition.h', 76 }, 77 { 78 find: /(_bridge_reanimated)/g, 79 replaceWith: `${prefix}$1`, 80 }, 81 { 82 paths: 'REATransitionAnimation.m', 83 find: /(SimAnimationDragCoefficient)\(/g, 84 replaceWith: `${prefix}$1(`, 85 }, 86 ], 87 }, 88 'react-native-gesture-handler': { 89 path: [ 90 { 91 find: /Handlers\/RN(\w+)Handler\.(h|m)/, 92 replaceWith: `Handlers/${prefix}RN$1Handler.$2`, 93 }, 94 ], 95 content: [ 96 { 97 find: `UIView+${prefix}React.h`, 98 replaceWith: `${prefix}UIView+React.h`, 99 }, 100 { 101 paths: '*.{h,m}', 102 find: /\bRN(\w+)(Handler|GestureRecognizer)\b/g, 103 replaceWith: `${prefix}RN$1$2`, 104 }, 105 ], 106 }, 107 'react-native-pager-view': { 108 path: [ 109 { 110 find: /(ReactNativePageView|ReactViewPagerManager)\.(h|m)/, 111 replaceWith: `${prefix}$1.$2`, 112 }, 113 ], 114 content: [ 115 { 116 find: `UIView+${prefix}React.h`, 117 replaceWith: `${prefix}UIView+React.h`, 118 }, 119 { 120 find: `${prefix}JKBigInteger.h`, 121 replaceWith: `JKBigInteger.h`, 122 }, 123 ], 124 }, 125 'react-native-screens': { 126 content: [], 127 }, 128 }; 129} 130