https://github.com/bakerface/react-native-svg-web
A web replacement for react-native-svg
https://github.com/bakerface/react-native-svg-web
Last synced: 7 months ago
JSON representation
A web replacement for react-native-svg
- Host: GitHub
- URL: https://github.com/bakerface/react-native-svg-web
- Owner: bakerface
- Created: 2017-05-20T13:04:28.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-26T19:47:33.000Z (over 3 years ago)
- Last Synced: 2025-05-20T23:48:58.302Z (12 months ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 45
- Watchers: 1
- Forks: 11
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# react-native-svg-web
[](http://badge.fury.io/js/react-native-svg-web)
[](https://www.npmjs.com/package/react-native-svg-web)
This package can be used as a drop-in replacement for [react-native-svg](https://github.com/react-native-community/react-native-svg) when targeting the web, or as a mock for [jest](https://github.com/facebook/jest) when testing react-native applications.
### Targeting the Web
Add the following to your webpack configuration:
``` javascript
module.exports = {
..., /* the existing configuration */
resolve: {
alias: {
'react-native-svg': 'react-native-svg-web'
}
}
};
```
### Mocking with Jest
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-svg-web'));
```