This file contains hidden or 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
| <Text style={{ marginLeft: 4 }}>- {pelicula.generos.map(g => g.name).join(', ')} </Text> | |
| // Suponiendo que generos es de tipo Genero | |
| export interface Genero; { | |
| id: number; | |
| name: string; | |
| } |
This file contains hidden or 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
| // 1- Crea una interface con los resultados esperados | |
| interface MoviesState { | |
| nowPlaying: Movie[]; | |
| popular: Movie[]; | |
| topRated: Movie[]; | |
| upcoming: Movie[]; | |
| } | |
| // 2- Usa la interface multiple en un solo 'useState' hook con inicializacion vacia | |
| const [moviesState, setMoviesState] = useState<MoviesState>({ |
This file contains hidden or 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
| // title?: string; | |
| { | |
| title ? <Text style={{ fontSize: 20, fontWeight: "bold", paddingLeft: 8, paddingBottom: 5 }}>{title}</Text> : <View style={{ height: 20, paddingBottom: 5 }}></View>; | |
| } | |
| // o solamente | |
| { | |
| title && <Text style={{ fontSize: 20, fontWeight: "bold", paddingLeft: 8, paddingBottom: 5 }}>{title}</Text>; | |
| } |
This file contains hidden or 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
| const { width } = Dimensions.get("window"); | |
| // or | |
| const windowDim = Dimensions.get("window"); |
This file contains hidden or 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
| // 1- Instalar axios | |
| npm install axios | |
| // 2- Importar Axios | |
| import axios from "axios"; | |
| // 3- Crear un file para centralizarlo con los parametros requeridos | |
| import axios from "axios"; | |
| const moviesAPI = axios.create({ |
This file contains hidden or 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 { StyleSheet } from "react-native"; | |
| export const styles = StyleSheet.create({ | |
| globalMargin: { | |
| marginHorizontal: 20, | |
| marginVertical: 8, | |
| }, | |
| mainTitle: { | |
| fontSize: 30, | |
| textAlign: "center", |