-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from GenerateNU/feature/svg
feat(metro.config.js): Implemented functionality to allow for SVG input
- Loading branch information
Showing
5 changed files
with
36 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
import * as React from 'react'; | ||
import { View, Text } from 'react-native'; | ||
import { getAllMedications } from './services/medication'; | ||
import UnionSvg from './assets/Union.svg'; | ||
|
||
export default function App() { | ||
const [medications, setMedications] = React.useState<Medication[]>(); | ||
React.useEffect(() => { | ||
getAllMedications().then((med) => setMedications(med)); | ||
}, []); | ||
|
||
// Adding the UnionSvg component here to show that it's able to be displayed here | ||
return ( | ||
<View className="flex-1 items-center w-[100vw] justify-center bg-white"> | ||
{medications && | ||
medications.map((med, index) => ( | ||
<Text key={index} className="pb-2"> | ||
{`Name: ${med.medication_name} id: ${med.medication_id}`} | ||
</Text> | ||
))} | ||
</View> | ||
{medications && | ||
medications.map((med, index) => ( | ||
<Text key={index} className="pb-2"> | ||
{`Name: ${med.medication_name} id: ${med.medication_id}`} | ||
</Text> | ||
))} | ||
<UnionSvg/> | ||
</View> | ||
); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
const { getDefaultConfig } = require('@expo/metro-config'); | ||
|
||
const defaultConfig = getDefaultConfig(__dirname); | ||
defaultConfig.resolver.sourceExts.push('cjs'); | ||
module.exports = (() => { | ||
const config = getDefaultConfig(__dirname); | ||
config.resolver.sourceExts.push('cjs'); | ||
const { transformer, resolver } = config; | ||
|
||
module.exports = defaultConfig; | ||
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; | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |