Created
June 21, 2020 18:31
-
-
Save WallysonGalvao/64dc51b3aaa5bd6b917e60290177c3d5 to your computer and use it in GitHub Desktop.
Marvelapp
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
import React from "react"; | |
import Constants from "expo-constants"; | |
import { useNavigation, useRoute } from "@react-navigation/native"; | |
import { LinearGradient } from "expo-linear-gradient"; | |
import { StyleSheet, View, Text, ImageBackground } from "react-native"; | |
interface IParams { | |
character: { | |
name: string; | |
alterEgo: string; | |
imagePath: string; | |
biography: string; | |
caracteristics: { | |
birth: number; | |
weight: { | |
value: number; | |
unity: string; | |
}; | |
height: { | |
value: number; | |
unity: string; | |
}; | |
universe: string; | |
}; | |
abilities: { | |
force: number; | |
intelligence: number; | |
agility: number; | |
endurance: number; | |
velocity: number; | |
}; | |
movies: string[]; | |
}; | |
} | |
const Detail = () => { | |
const navigation = useNavigation(); | |
const route = useRoute(); | |
const routeParams = route.params as IParams; | |
const { character } = routeParams; | |
return ( | |
<ImageBackground | |
source={{ uri: `http://192.168.0.18:3333/${character.imagePath}` }} | |
style={styles.container} | |
> | |
<LinearGradient | |
colors={["transparent", "#000"]} | |
style={[ | |
{ | |
position: "absolute", | |
left: 0, | |
right: 0, | |
top: 0, | |
height: "150%", | |
}, | |
styles.container, | |
]} | |
></LinearGradient> | |
</ImageBackground> | |
); | |
}; | |
export default Detail; | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
paddingHorizontal: 32, | |
paddingTop: 20 + Constants.statusBarHeight, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment