React native web svgs with separate svg file support
npm install react-native-svgxml-webAdd the following to your webpack configuration:
`` javascript
module.exports = {
..., / the existing configuration /
resolve: {
alias: {
'react-native-svg': 'react-native-svgxml-web'
}
}
};
`
Add the following to your package.json.
` json`
{
"jest": {
"setupFiles": [
"./jest/mocks/react-native-svg.js"
]
}
};
And then create a file ./jest/mocks/react-native-svg.js:
` javascript``
jest.mock('react-native-svg', () => require('react-native-svgxml-web'));