Skip to content

Commit c217980

Browse files
authored
Drop support for React < 18 (#501)
1 parent 51a9335 commit c217980

File tree

16 files changed

+2468
-17697
lines changed

16 files changed

+2468
-17697
lines changed

bin/build/targets/react/resources/icon-template.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export function getTemplate(native, iconoirContextPath) {
1818
return tpl`
1919
${useClientDirective}
2020
${variables.imports};
21-
${iconoirContextImport};
21+
${iconoirContextImport}
2222
2323
${variables.interfaces};
2424

examples/react-native/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ node_modules/
77
.expo/
88
dist/
99
web-build/
10+
expo-env.d.ts
1011

1112
# Native
1213
*.orig.*
File renamed without changes.

examples/react-native/app.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
{
22
"expo": {
33
"name": "Iconoir",
4-
"slug": "react-native-expo",
4+
"slug": "example-react-native",
55
"version": "1.0.0",
66
"orientation": "portrait",
77
"userInterfaceStyle": "light",
8-
"assetBundlePatterns": ["**/*"],
8+
"newArchEnabled": true,
9+
"splash": {
10+
"backgroundColor": "#ffffff"
11+
},
912
"ios": {
1013
"supportsTablet": true
14+
},
15+
"android": {
16+
"adaptiveIcon": {
17+
"backgroundColor": "#ffffff"
18+
}
1119
}
1220
}
1321
}

examples/react-native/babel.config.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

examples/react-native/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { registerRootComponent } from 'expo';
2+
3+
import App from './App';
4+
5+
// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
6+
// It also ensures that whether you load the app in Expo Go or in a native build,
7+
// the environment is set up appropriately
8+
registerRootComponent(App);

examples/react-native/metro.config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Workaround to be able to import iconoir lib from workspace.
3+
* See also: https://github.com/pnpm/pnpm/issues/4286
4+
*/
5+
6+
const { makeMetroConfig } = require('@rnx-kit/metro-config');
7+
const MetroSymlinksResolver = require('@rnx-kit/metro-resolver-symlinks');
8+
const { getDefaultConfig } = require('expo/metro-config');
9+
10+
const symlinksResolver = MetroSymlinksResolver({
11+
remapModule: (_context, moduleName) => {
12+
if (moduleName === 'iconoir-react-native') {
13+
return require.resolve(moduleName);
14+
}
15+
16+
return moduleName;
17+
},
18+
},
19+
);
20+
21+
/** @type {import('expo/metro-config').MetroConfig} */
22+
const expoConfig = getDefaultConfig(__dirname);
23+
24+
/** @type {import('expo/metro-config').MetroConfig} */
25+
module.exports = makeMetroConfig({
26+
...expoConfig,
27+
resolver: {
28+
...expoConfig.resolver,
29+
resolveRequest: symlinksResolver,
30+
},
31+
});

0 commit comments

Comments
 (0)