mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-09-15 23:29:41 -04:00
* nativewind 4 spike * themed and cssInterop fixes * clearify comment on inline Animated.View styles * remaining style fixes and supplementary agent docs * fix pill button on media screens --------- Co-authored-by: Johannes Klein <17345891+jtklein@users.noreply.github.com>
65 lines
1.8 KiB
JavaScript
65 lines
1.8 KiB
JavaScript
/**
|
|
* Metro configuration for React Native
|
|
* https://reactnative.dev/docs/metro
|
|
* with added config for react-native-svg-transformer
|
|
* https://www.npmjs.com/package/react-native-svg-transformer?activeTab
|
|
*
|
|
* @format
|
|
*/
|
|
// eslint-disable-next-line import/no-unresolved
|
|
const { getDefaultConfig, mergeConfig } = require( "@react-native/metro-config" );
|
|
const { withRozenite } = require( "@rozenite/metro" );
|
|
const {
|
|
withRozeniteRequireProfiler,
|
|
} = require( "@rozenite/require-profiler-plugin/metro" );
|
|
const { withNativeWind } = require( "nativewind/metro" );
|
|
|
|
const {
|
|
resolver: { sourceExts, assetExts },
|
|
} = getDefaultConfig();
|
|
|
|
const localPackagePaths = [
|
|
// If you reference any local paths in package.json, you'll need to list them here
|
|
];
|
|
|
|
/**
|
|
* Metro configuration
|
|
* https://facebook.github.io/metro/docs/configuration
|
|
*
|
|
* @type {import('@react-native/metro-config').MetroConfig}
|
|
*/
|
|
const config = {
|
|
transformer: {
|
|
babelTransformerPath: require.resolve( "react-native-svg-transformer/react-native" ),
|
|
},
|
|
resolver: {
|
|
assetExts: assetExts.filter( ext => ext !== "svg" ),
|
|
sourceExts:
|
|
process.env.MOCK_MODE === "e2e"
|
|
? ["e2e-mock", ...sourceExts, "svg"]
|
|
: [...sourceExts, "svg"],
|
|
nodeModulesPaths: [...localPackagePaths],
|
|
},
|
|
watchFolders: [...localPackagePaths],
|
|
};
|
|
|
|
const configWithRozenite = withRozenite(
|
|
mergeConfig( getDefaultConfig( __dirname ), config ),
|
|
{
|
|
enabled: process.env.WITH_ROZENITE === "true",
|
|
enhanceMetroConfig: config => withRozeniteRequireProfiler( config ),
|
|
},
|
|
);
|
|
|
|
const configWithRozeniteAndNativeWind = withNativeWind(
|
|
configWithRozenite,
|
|
{
|
|
input: "./global.css",
|
|
// nativewind 4 defaults to 14px per rem; nativewind 2 used 16px, and all
|
|
// of our rem-based spacing was designed against that
|
|
inlineRem: 16,
|
|
},
|
|
);
|
|
|
|
module.exports = configWithRozeniteAndNativeWind;
|