Skip to content

Commit

Permalink
SVG transformer package added
Browse files Browse the repository at this point in the history
  • Loading branch information
shyambhongle committed Mar 11, 2024
1 parent f961ba8 commit bdc9831
Show file tree
Hide file tree
Showing 4 changed files with 338 additions and 7 deletions.
6 changes: 6 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module "*.svg" {
import React from "react";
import { SvgProps } from "react-native-svg";
const content: React.FC<SvgProps>;
export default content;
}
20 changes: 20 additions & 0 deletions metro.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const { getDefaultConfig } = require("expo/metro-config");

module.exports = (() => {
const config = getDefaultConfig(__dirname);

const { transformer, resolver } = config;

config.transformer = {
...transformer,
babelTransformerPath: require.resolve("react-native-svg-transformer")
};
config.resolver = {
...resolver,
assetExts: resolver.assetExts.filter((ext) => ext !== "svg"),
sourceExts: [...resolver.sourceExts, "svg"]
};

return config;
})();
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"react-native": "0.72.10",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native-svg": "13.9.0",
"realm": "^12.6.2"
},
"devDependencies": {
Expand All @@ -39,6 +40,7 @@
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"react-native-svg-transformer": "^1.3.0",
"typescript": "^5.1.3"
},
"lint-staged": {
Expand Down
Loading

0 comments on commit bdc9831

Please sign in to comment.