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";
8
8
9
9
import type { StarshipProps } from "../../api/types" ;
10
10
11
- import { useImage } from "../hooks/useImage" ;
12
11
import { Routes } from "../navigation/Routes" ;
12
+ import { getImageSource } from "../utils/getImageSource" ;
13
13
import { withAnimated } from "../utils/withAnimated" ;
14
14
15
15
const AnimatedCard = withAnimated ( Card ) ;
@@ -27,7 +27,7 @@ interface StarshipDetailsScreenParams {
27
27
export const StarshipCard = ( { index, ship } : StarshipCardProps ) => {
28
28
const { cost_in_credits : price , manufacturer, name : title } = ship ;
29
29
30
- const source = useImage ( title ) ;
30
+ const source = getImageSource ( title ) ;
31
31
32
32
const handleBuy = ( ) => {
33
33
Alert . alert ( "Give me the money!" ) ;
Original file line number Diff line number Diff line change 1
1
/**
2
- * A custom hook that returns the image source for a given starship title.
2
+ * Returns the image source for a given starship title.
3
3
*
4
4
* @param {string } title - The title of the starship.
5
- * @returns {any } The image source corresponding to the starship title.
6
5
*
7
6
* @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.
10
11
*/
11
- export const useImage = ( title : string ) => {
12
+ export const getImageSource = ( title : string ) => {
12
13
const imageName = `${ title . toLowerCase ( ) . replace ( " " , "" ) } ` ;
13
14
14
15
let source ;
You can’t perform that action at this time.
0 commit comments