-
Notifications
You must be signed in to change notification settings - Fork 116
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
SVGR no longer works on iOS release build after upgraded to RN 0.63.0 #98
Comments
Thanks, I need to check and verify this one. |
Looks like this is related to facebook/react-native#29351, facebook/react-native@a8e8502
if (filename.endsWith(".svg") || filename.endsWith(".svgx")) {
var config = resolveConfig.sync(resolveConfigDir(filename));
+ console.log(filename, config); Output:
I have a monorepo structure, the real relative path of these files should be:
If I run As a workaround, adding Can we detect whether the transformer is invoked from |
So is this a bug or a feature in RN 0.63? It seems like people are reporting that the bundling is not working for them, so I guess that this might get fixed in a patch? |
It's a feature that allows |
I am having the issue on Android after updating to RN 0.63.1 .. any work around? Thanks! |
Sorry for being slow with this @stackia. From the linked commits it seems that this is caused by a small feature on iOS, but in reality it breaks all 3rd party transformer plugins for React Native. Before making any fixes, I want make sure that I understand what the problem is and what is a correct fix for it. For now I would recommend to stick with React Native 0.62 instead of the new 0.63 until I can be sure that PR #99 is the correct way to apply the fix for all of the libraries that I have published. |
Weird.. In some of my devices, the svg is showing up. In some of the devices, it show up sometimes. The behaviour is not very consistent. Could there be some config issue? |
FWIW, I have the same issue on 0.62.2 and in dev. My react-native-svg-transformer version is 0.14.3, and my react-native-svg version is 12.1.0. Simulator is iOS 13.5. My .svgrrc:
My metro.config.js:
EDIT: Weirdly, once I put in the logging statement that @stackia tried, the issue resolved itself. 🤷♂️ |
So, I'm currently waiting for someone from the React Native team to comment something on these open issues & PR, and I'll release a new version of the transformer with a fix if it's not getting fixed in React Native. Issues: |
any news about this? |
@jmunozDevsu It looks like this got fixed in React Native, but there hasn't been a new version yet: facebook/react-native#29477 |
I haven't had time to try out yet, but this issue should be fixed in the latest 0.63.3 patch version: |
Closing since this has been fixed in React Native version 0.63.3. Please update to that patch version. |
I just upgraded to "react-native": "0.72.3", and I have the same problem. declarations.d.ts declare module '*.svg' {
import React from 'react';
import {SvgProps} from 'react-native-svg';
const content: React.FC<SvgProps>;
export default content;
} metro.config.js const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
const config = (async () => {
const {
resolver: {sourceExts, assetExts},
} = await getDefaultConfig();
return {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
assetExts: assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg', 'cjs'],
resolveRequest: (context, moduleName, platform) => {
if (moduleName.startsWith('graphql-request')) {
return {
filePath: `${__dirname}/node_modules/graphql-request/build/esm/index.js`,
type: 'sourceFile',
};
}
return context.resolveRequest(context, moduleName, platform);
},
},
};
})();
module.exports = mergeConfig(getDefaultConfig(__dirname), config); package.json
|
@facuescobar did you find a solution? |
After upgrading to RN 0.63.0, on iOS release build, icons no longer fills with my customized color in .svgrrc.
But on iOS dev build, Android dev/release build it works well.
The text was updated successfully, but these errors were encountered: