1
- import React from "react" ;
2
1
import {
2
+ Alert ,
3
3
Pressable ,
4
4
ScrollView ,
5
5
StyleSheet ,
6
6
TouchableOpacity ,
7
7
View ,
8
8
} from "react-native" ;
9
- import { Chip , DataTable , FAB , List , Text } from "react-native-paper" ;
9
+ import { Chip , DataTable , FAB , List , Text , useTheme } from "react-native-paper" ;
10
10
import { useSharedValue , withSpring } from "react-native-reanimated" ;
11
11
import { FontAwesome5 } from "@expo/vector-icons" ;
12
12
import { useNavigation } from "@react-navigation/native" ;
@@ -38,28 +38,30 @@ export const StarshipDetailsScreen = ({
38
38
hyperdrive_rating,
39
39
max_atmosphering_speed,
40
40
model,
41
- // @ts -ignore
41
+ //@ts -expect-error the api does not have `image` field
42
42
image,
43
43
} = route . params ;
44
44
45
- // const source = useImage(name);
46
45
const navigation = useNavigation ( ) ;
47
46
48
47
const handleClose = ( ) => {
49
48
navigation . goBack ( ) ;
50
49
} ;
51
50
52
51
const handleBuy = ( ) => {
53
- // Alert.alert("Give me the money!");
52
+ Alert . alert ( "Give me the money!" ) ;
54
53
} ;
55
54
56
55
const scale = useSharedValue ( 1 ) ;
57
56
57
+ const theme = useTheme ( ) ;
58
+
58
59
return (
59
- < View >
60
+ < View style = { { backgroundColor : theme . colors . background } } >
60
61
< ScrollView >
61
62
< View style = { styles . scrollContainer } >
62
- < View style = { styles . imageContainer } >
63
+ { /* eslint-disable-next-line react-native/no-color-literals -- keep it always black */ }
64
+ < View style = { [ styles . imageContainer , { backgroundColor : "black" } ] } >
63
65
< Image
64
66
style = { { width : "100%" , height : 350 } }
65
67
source = { image }
@@ -68,7 +70,8 @@ export const StarshipDetailsScreen = ({
68
70
< View style = { [ styles . closeContainer , styles . left ] } >
69
71
< TouchableOpacity
70
72
onPress = { handleClose }
71
- style = { styles . closeButton }
73
+ // eslint-disable-next-line react-native/no-color-literals -- keep it always white
74
+ style = { [ styles . closeButton , { backgroundColor : "white" } ] }
72
75
>
73
76
< FontAwesome5
74
77
name = "times"
@@ -163,7 +166,6 @@ const styles = StyleSheet.create({
163
166
paddingVertical : 24 ,
164
167
} ,
165
168
closeButton : {
166
- backgroundColor : "white" ,
167
169
borderRadius : 50 ,
168
170
paddingHorizontal : 12 ,
169
171
paddingVertical : 8 ,
@@ -178,7 +180,6 @@ const styles = StyleSheet.create({
178
180
right : 42 ,
179
181
} ,
180
182
imageContainer : {
181
- backgroundColor : "black" ,
182
183
paddingTop : 32 ,
183
184
} ,
184
185
left : {
0 commit comments