Skip to content

Commit

Permalink
Drop support for React < 18 (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
paescuj authored Dec 17, 2024
1 parent 51a9335 commit c217980
Show file tree
Hide file tree
Showing 16 changed files with 2,468 additions and 17,697 deletions.
2 changes: 1 addition & 1 deletion bin/build/targets/react/resources/icon-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function getTemplate(native, iconoirContextPath) {
return tpl`
${useClientDirective}
${variables.imports};
${iconoirContextImport};
${iconoirContextImport}
${variables.interfaces};
Expand Down
1 change: 1 addition & 0 deletions examples/react-native/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ node_modules/
.expo/
dist/
web-build/
expo-env.d.ts

# Native
*.orig.*
Expand Down
File renamed without changes.
12 changes: 10 additions & 2 deletions examples/react-native/app.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
{
"expo": {
"name": "Iconoir",
"slug": "react-native-expo",
"slug": "example-react-native",
"version": "1.0.0",
"orientation": "portrait",
"userInterfaceStyle": "light",
"assetBundlePatterns": ["**/*"],
"newArchEnabled": true,
"splash": {
"backgroundColor": "#ffffff"
},
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"backgroundColor": "#ffffff"
}
}
}
}
7 changes: 0 additions & 7 deletions examples/react-native/babel.config.js

This file was deleted.

8 changes: 8 additions & 0 deletions examples/react-native/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { registerRootComponent } from 'expo';

import App from './App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
31 changes: 31 additions & 0 deletions examples/react-native/metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Workaround to be able to import iconoir lib from workspace.
* See also: https://github.com/pnpm/pnpm/issues/4286
*/

const { makeMetroConfig } = require('@rnx-kit/metro-config');
const MetroSymlinksResolver = require('@rnx-kit/metro-resolver-symlinks');
const { getDefaultConfig } = require('expo/metro-config');

const symlinksResolver = MetroSymlinksResolver({
remapModule: (_context, moduleName) => {
if (moduleName === 'iconoir-react-native') {
return require.resolve(moduleName);
}

return moduleName;
},
},
);

/** @type {import('expo/metro-config').MetroConfig} */
const expoConfig = getDefaultConfig(__dirname);

/** @type {import('expo/metro-config').MetroConfig} */
module.exports = makeMetroConfig({
...expoConfig,
resolver: {
...expoConfig.resolver,
resolveRequest: symlinksResolver,
},
});
Loading

0 comments on commit c217980

Please sign in to comment.