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

Does not work with react Native 0.59.x #14

Closed
Thioby opened this issue Mar 31, 2019 · 3 comments
Closed

Does not work with react Native 0.59.x #14

Thioby opened this issue Mar 31, 2019 · 3 comments

Comments

@Thioby
Copy link

Thioby commented Mar 31, 2019

I just grabbed your example app and upgraded RN to version 0.59.2.

Application does not work at all either on IOS and Android.
Screenshot_1554058909

Dependencies:

"react": "16.8.3",
"react-native": "0.59.2",
"react-native-svg": "^9.3.5",
"react-native-svg-transformer": "^0.12.1",
@Thioby Thioby changed the title Does not working with react Native 0.59.x Does not work with react Native 0.59.x Mar 31, 2019
@kristerkari
Copy link
Owner

Thanks!

I created a fresh 0.59.2 and added react-native-svg and react-native-svg-transfomer. Everything seems to be working fine, so it might be that you have something wrong in your configuration files.

Please see the example project that I uploaded and check your metro.config.js:
https://github.com/kristerkari/react-native-0.59-svg-example/blob/master/metro.config.js

@Thioby
Copy link
Author

Thioby commented Apr 1, 2019

@kristerkari Thanks, problem was with metro.config.js

I did:

module.exports = (async () => {
    const {
        resolver: { sourceExts, assetExts }
    } = await getDefaultConfig();
    return {
        transformer: {
            babelTransformerPath: require.resolve("react-native-svg-transformer")
        },
        resolver: {
            assetExts: assetExts.filter(ext => ext !== "svg"),
            sourceExts: [...sourceExts, "svg"]
        }
    };
})();

module.exports = {
    transformer: {
        getTransformOptions: async () => ({
            transform: {
                experimentalImportSupport: false,
                inlineRequires: false,
            },
        }),
    },
};

instead of:

const { getDefaultConfig } = require("metro-config");

module.exports = (async () => {
    const {
        resolver: { sourceExts, assetExts }
    } = await getDefaultConfig();
    return {
        transformer: {
            getTransformOptions: async () => ({
                transform: {
                    experimentalImportSupport: false,
                    inlineRequires: false
                }
            }),
            babelTransformerPath: require.resolve("react-native-svg-transformer")
        },
        resolver: {
            assetExts: assetExts.filter(ext => ext !== "svg"),
            sourceExts: [...sourceExts, "svg"]
        }
    };
})();

@kristerkari
Copy link
Owner

Oh yeah I need to change the README to say that you need to merge the config with the existing one, not only add the code.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants