-
Notifications
You must be signed in to change notification settings - Fork 47
Expand file tree
/
Copy pathmetro.config.js
More file actions
31 lines (29 loc) · 1.02 KB
/
metro.config.js
File metadata and controls
31 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const path = require('path');
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('metro-config').MetroConfig}
*/
const config = {
resolver: {
// Replace react-native-screens with our mock on iOS
// This fixes crashes with New Architecture in RN 0.83
resolveRequest: (context, moduleName, platform) => {
// Intercept all react-native-screens imports on iOS
if (platform === 'ios' &&
(moduleName === 'react-native-screens' ||
moduleName.startsWith('react-native-screens/'))) {
// For the main module and any subpaths, use our mock
return {
filePath: path.resolve(__dirname, 'src/react-native-screens-mock.js'),
type: 'sourceFile',
};
}
// Fall back to default resolution
return context.resolveRequest(context, moduleName, platform);
},
},
};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);