1import fs from 'fs-extra'; 2 3import { Podspec } from '../../CocoaPods'; 4import { VendoringTargetConfig } from '../types'; 5 6const config: VendoringTargetConfig = { 7 name: 'Expo Go', 8 platforms: { 9 ios: { 10 targetDirectory: 'ios/vendored/unversioned', 11 }, 12 android: { 13 targetDirectory: 'android/vendored/unversioned', 14 }, 15 }, 16 modules: { 17 '@stripe/stripe-react-native': { 18 source: 'https://github.com/stripe/stripe-react-native.git', 19 ios: { 20 mutatePodspec(podspec: Podspec) { 21 if (!podspec.pod_target_xcconfig) { 22 podspec.pod_target_xcconfig = {}; 23 } 24 podspec.pod_target_xcconfig['HEADER_SEARCH_PATHS'] = 25 '"${PODS_ROOT}/Stripe/Stripe3DS2" "${PODS_ROOT}/Headers/Public/Stripe"'; 26 }, 27 }, 28 // android: { 29 // excludeFiles: [ 30 // 'android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt', 31 // 'android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt', 32 // ], 33 // transforms: { 34 // content: [ 35 // { 36 // paths: 'StripeSdkPackage.kt', 37 // find: /, GooglePayButtonManager\(\)/, 38 // replaceWith: '', 39 // }, 40 // ], 41 // }, 42 // }, 43 }, 44 'lottie-react-native': { 45 source: 'https://github.com/lottie-react-native/lottie-react-native.git', 46 ios: {}, 47 // android: { 48 // includeFiles: 'src/android/**', 49 // excludeFiles: ['src/android/gradle.properties', 'src/android/gradle-maven-push.gradle'], 50 // }, 51 }, 52 'react-native-gesture-handler': { 53 source: 'https://github.com/software-mansion/react-native-gesture-handler.git', 54 semverPrefix: '~', 55 ios: {}, 56 }, 57 'react-native-reanimated': { 58 source: 'https://github.com/software-mansion/react-native-reanimated.git', 59 semverPrefix: '~', 60 ios: { 61 async preReadPodspecHookAsync(podspecPath: string): Promise<string> { 62 let content = await fs.readFile(podspecPath, 'utf-8'); 63 content = content.replace("reactVersion = '0.66.0'", "reactVersion = '0.67.2'"); 64 content = content.replace(/(puts "\[RNReanimated\].*$)/gm, '# $1'); 65 await fs.writeFile(podspecPath, content); 66 return podspecPath; 67 }, 68 mutatePodspec(podspec: Podspec) { 69 // TODO: The podspec checks RN version from package.json. 70 // however we don't have RN's package.json in the place where it looks for and the fallback 71 // is set to `0.66.0`. 72 // currently we change the version in `preReadPodspecHookAsync`, once reanimated removed the `puts` in error message. 73 // we should use the json based transformation here. that's why we keep the referenced code and comment out. 74 // podspec.compiler_flags = podspec.compiler_flags.replace('RNVERSION=64', 'RNVERSION=63'); 75 // podspec.xcconfig.OTHER_CFLAGS = podspec.xcconfig.OTHER_CFLAGS.replace( 76 // 'RNVERSION=64', 77 // 'RNVERSION=63' 78 // ); 79 }, 80 transforms: { 81 content: [ 82 { 83 paths: 'REAUIManager.mm', 84 find: /^#import "RCT(.*).h"$/gm, 85 replaceWith: '#import <React/RCT$1.h>', 86 }, 87 { 88 paths: 'REAPropsNode.m', 89 find: /^#import "React\/RCT(.*).h"$/gm, 90 replaceWith: '#import <React/RCT$1.h>', 91 }, 92 ], 93 }, 94 }, 95 }, 96 'react-native-screens': { 97 source: 'https://github.com/software-mansion/react-native-screens.git', 98 semverPrefix: '~', 99 ios: {}, 100 // TODO: Uncomment once the new vendoring scripts supports Android 101 // android: { 102 // transforms: { 103 // content: [ 104 // { 105 // paths: 'ScreenStack.kt', 106 // find: /(?=^class ScreenStack\()/m, 107 // replaceWith: `import host.exp.expoview.R\n\n`, 108 // }, 109 // { 110 // paths: 'ScreenStackHeaderConfig.kt', 111 // find: /(?=^class ScreenStackHeaderConfig\()/m, 112 // replaceWith: `import host.exp.expoview.BuildConfig\nimport host.exp.expoview.R\n\n`, 113 // }, 114 // ], 115 // }, 116 // }, 117 }, 118 'amazon-cognito-identity-js': { 119 source: 'https://github.com/aws-amplify/amplify-js.git', 120 }, 121 'react-native-view-shot': { 122 source: 'https://github.com/gre/react-native-view-shot.git', 123 }, 124 'react-native-svg': { 125 source: 'https://github.com/react-native-svg/react-native-svg', 126 }, 127 'react-native-maps': { 128 source: 'https://github.com/react-native-maps/react-native-maps', 129 }, 130 '@react-native-community/netinfo': { 131 source: 'https://github.com/react-native-netinfo/react-native-netinfo', 132 ios: {}, 133 }, 134 'react-native-webview': { 135 source: 'https://github.com/react-native-webview/react-native-webview.git', 136 ios: { 137 transforms: { 138 // react-native-webview exposes `useSharedProcessPool` property which has to be handled differently in Expo Go. 139 // After upgrading this library, please ensure that proper patch is in place. 140 // See commit https://github.com/expo/expo/commit/3aeb66e33dc391399ea1c90fd166425130d17a12 141 content: [ 142 { 143 paths: 'RNCWKProcessPoolManager.h', 144 find: '- (WKProcessPool *)sharedProcessPool;', 145 replaceWith: '- (WKProcessPool *)sharedProcessPoolForScopeKey:(NSString *)scopeKey;', 146 }, 147 { 148 paths: 'RNCWKProcessPoolManager.m', 149 find: 'WKProcessPool *_sharedProcessPool;', 150 replaceWith: 151 'WKProcessPool *_sharedProcessPool;\n NSMutableDictionary<NSString *, WKProcessPool *> *_pools;', 152 }, 153 { 154 paths: 'RNCWKProcessPoolManager.m', 155 find: '@implementation RNCWKProcessPoolManager', 156 replaceWith: `@implementation RNCWKProcessPoolManager 157 158- (instancetype)init 159{ 160 if (self = [super init]) { 161 _pools = [NSMutableDictionary new]; 162 } 163 return self; 164} 165 166- (WKProcessPool *)sharedProcessPoolForScopeKey:(NSString *)scopeKey 167{ 168 if (!scopeKey) { 169 return [self sharedProcessPool]; 170 } 171 if (!_pools[scopeKey]) { 172 _pools[scopeKey] = [[WKProcessPool alloc] init]; 173 } 174 return _pools[scopeKey]; 175} 176`, 177 }, 178 { 179 paths: 'RNCWebView.h', 180 find: /@interface RNCWebView : RCTView/, 181 replaceWith: '$&\n@property (nonatomic, strong) NSString *scopeKey;', 182 }, 183 { 184 paths: 'RNCWebView.m', 185 find: /(\[\[RNCWKProcessPoolManager sharedManager\] sharedProcessPool)]/, 186 replaceWith: '$1ForScopeKey:self.scopeKey]', 187 }, 188 { 189 paths: 'RNCWebViewManager.m', 190 find: /@implementation RNCWebViewManager\s*{/, 191 replaceWith: '$&\n NSString *_scopeKey;', 192 }, 193 { 194 paths: 'RNCWebViewManager.m', 195 find: '*webView = [RNCWebView new];', 196 replaceWith: '*webView = [RNCWebView new];\n webView.scopeKey = _scopeKey;', 197 }, 198 { 199 paths: 'RNCWebViewManager.m', 200 find: /RCT_EXPORT_MODULE\(\)/, 201 replaceWith: `- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId 202 scopeKey:(NSString *)scopeKey 203 easProjectId:(NSString *)easProjectId 204 kernelServiceDelegate:(id)kernelServiceInstance 205 params:(NSDictionary *)params 206{ 207 if (self = [super init]) { 208 _scopeKey = scopeKey; 209 } 210 return self; 211}`, 212 }, 213 ], 214 }, 215 }, 216 }, 217 'react-native-safe-area-context': { 218 source: 'https://github.com/th3rdwave/react-native-safe-area-context', 219 }, 220 '@react-native-community/datetimepicker': { 221 source: 'https://github.com/react-native-community/react-native-datetimepicker.git', 222 // TODO: Uncomment the following once the new vendoring scripts support Android 223 // android: { 224 // transforms: { 225 // content: [ 226 // { 227 // paths: 'RNTimePickerDialogFragment.java', 228 // find: /"ClockTimePickerDialog"/, 229 // replaceWith: '"ReactAndroidClockTimePickerDialog"', 230 // }, 231 // { 232 // paths: 'RNTimePickerDialogFragment.java', 233 // find: /"SpinnerTimePickerDialog"/, 234 // replaceWith: '"ReactAndroidSpinnerTimePickerDialog"', 235 // }, 236 // { 237 // paths: 'RNDatePickerDialogFragment.java', 238 // find: /"CalendarDatePickerDialog"/, 239 // replaceWith: '"ReactAndroidCalendarDatePickerDialog"', 240 // }, 241 // { 242 // paths: 'RNDatePickerDialogFragment.java', 243 // find: /"SpinnerDatePickerDialog"/, 244 // replaceWith: '"ReactAndroidSpinnerDatePickerDialog"', 245 // }, 246 // ], 247 // }, 248 // }, 249 }, 250 // NOTE(brentvatne): masked-view has been renamed to 251 // @react-native-masked-view/masked-view but we should synchronize moving 252 // over to the new package name along with React Navigation 253 '@react-native-masked-view/masked-view': { 254 source: 'https://github.com/react-native-masked-view/masked-view', 255 }, 256 'react-native-pager-view': { 257 source: 'https://github.com/callstack/react-native-viewpager', 258 ios: {}, 259 }, 260 'react-native-shared-element': { 261 source: 'https://github.com/IjzerenHein/react-native-shared-element', 262 }, 263 '@react-native-segmented-control/segmented-control': { 264 source: 'https://github.com/react-native-segmented-control/segmented-control', 265 ios: {}, 266 }, 267 '@react-native-picker/picker': { 268 source: 'https://github.com/react-native-picker/picker', 269 }, 270 '@react-native-community/slider': { 271 source: 'https://github.com/callstack/react-native-slider', 272 packageJsonPath: 'src/package.json', 273 }, 274 }, 275}; 276 277export default config; 278