Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop support for React < 18 #501

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading