File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -8,8 +8,8 @@ import { Image } from "~/components/Image";
88
99import type { StarshipProps } from "../../api/types" ;
1010
11- import { useImage } from "../hooks/useImage" ;
1211import { Routes } from "../navigation/Routes" ;
12+ import { getImageSource } from "../utils/getImageSource" ;
1313import { withAnimated } from "../utils/withAnimated" ;
1414
1515const AnimatedCard = withAnimated ( Card ) ;
@@ -27,7 +27,7 @@ interface StarshipDetailsScreenParams {
2727export const StarshipCard = ( { index, ship } : StarshipCardProps ) => {
2828 const { cost_in_credits : price , manufacturer, name : title } = ship ;
2929
30- const source = useImage ( title ) ;
30+ const source = getImageSource ( title ) ;
3131
3232 const handleBuy = ( ) => {
3333 Alert . alert ( "Give me the money!" ) ;
Original file line number Diff line number Diff line change 11/**
2- * A custom hook that returns the image source for a given starship title.
2+ * Returns the image source for a given starship title.
33 *
44 * @param {string } title - The title of the starship.
5- * @returns {any } The image source corresponding to the starship title.
65 *
76 * @example
8- * const imageSource = useImage("Millennium Falcon");
9- * // imageSource will be the path to the Millennium Falcon image.
7+ * ```
8+ * const imageSource = getImageSource("Millennium Falcon");
9+ * ```
10+ * imageSource will be the path to the Millennium Falcon image.
1011 */
11- export const useImage = ( title : string ) => {
12+ export const getImageSource = ( title : string ) => {
1213 const imageName = `${ title . toLowerCase ( ) . replace ( " " , "" ) } ` ;
1314
1415 let source ;
You can’t perform that action at this time.
0 commit comments