4. Create `declarations.d.ts` file with next content:
```typescript
declare module "*.svg" {
import React from 'react';
import { SvgProps } from "react-native-svg";
const content: React.FC<SvgProps>;
export default content;
}
Import svg on App.tsx
import { StatusBar } from 'expo-status-bar';
import { View } from 'react-native';
import LogoEmber from "./assets/ember.svg"; // IMPORT SVG FILE
export default function App() {
return (
);
}
5. Run app with `expo start` command
### Error on web
![imagen](https://user-images.githubusercontent.com/22831024/152662890-43132201-7bcb-4fe9-9e04-ab3c48ad0627.png)
My version expo
Steps:
npm install react-navite-svg
andnpm install -D react-native-svg-transformer
metro.config.js
and use next 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; })();
export default function App() { return (
); }