1+ import { StatusBar } from 'expo-status-bar' ;
2+ // CORRECCIÓN: SafeAreaView ahora viene de react-native
3+ import { StyleSheet , Text , View , ScrollView , SafeAreaView } from 'react-native' ;
4+ import { useState } from 'react' ;
5+ // Asegúrate de que esta ruta apunte a tu carpeta src
6+ import Alumno from './src/components/Alumno' ;
7+
8+ export default function App ( ) {
9+ const alumnos = [
10+ // ... (Aquí va toda la lista de alumnos que mandó tu maestra) ...
11+ { nombre : 'CANDELARIA MORA SAMANTHA' , matricula : '2114354' } ,
12+ { nombre : 'CANTU SILVA JAVIER' , matricula : '2111889' } ,
13+ {
14+ nombre : 'CARMONA LOZANO ANGEL EMILIANO' ,
15+ matricula : '2069119'
16+ } ,
17+ {
18+ nombre : 'CASTILLO ACOSTA JORGE' ,
19+ matricula : '2132842'
20+ } ,
21+ {
22+ nombre : 'DAVILA GONZALEZ ALDO ADRIAN' ,
23+ matricula : '1994122'
24+ } ,
25+ {
26+ nombre : 'DURAN BARRIENTOS FABRIZIO' ,
27+ matricula : '2018230'
28+ } ,
29+ {
30+ nombre : 'FLORES GONZALEZ SEBASTIAN' ,
31+ matricula : '2104564'
32+ } ,
33+ {
34+ nombre : 'DURAN BARRIENTOS FABRIZIO' ,
35+ matricula : '2018230'
36+ } ,
37+ {
38+ nombre : 'FLORES GONZALEZ SEBASTIAN' ,
39+ matricula : '2104564'
40+ } ,
41+ {
42+ nombre : 'FLORES LÓPEZ DIEGO' ,
43+ matricula : '2066033'
44+ } ,
45+ {
46+ nombre : 'FLORES MARTINEZ ERICK ADRIAN' ,
47+ matricula : '2132976'
48+ } ,
49+ {
50+ nombre : 'GARZA AVALOS DIEGO' ,
51+ matricula : '2066114'
52+ } ,
53+ {
54+ nombre : 'GONZALEZ OVALLE CHRISTIAN GABRIEL' ,
55+ matricula : '2031243'
56+ } ,
57+ {
58+ nombre : 'GRANJA PEÑA DIEGO' ,
59+ matricula : '2064733'
60+ } ,
61+ {
62+ nombre : 'IBARRA RODRIGUEZ ALEXIS' ,
63+ matricula : '2031243'
64+ } ,
65+ {
66+ nombre : 'MARTINEZ ELIAS ANGEL SEBASTIAN' ,
67+ matricula : '2064733'
68+ } ,
69+ {
70+ nombre : 'MENDIETA GONZALEZ ESMERALDA GABRIELA' ,
71+ matricula : '2094647'
72+ } ,
73+ {
74+ nombre : 'MIRELES VELAZQUEZ ALEJANDRO' ,
75+ matricula : '2005102'
76+ } ,
77+ {
78+ nombre : 'MONSIVAIS SALAZAR ANDRES' ,
79+ matricula : '2064574'
80+ } ,
81+ {
82+ nombre : 'PARRAZALEZ VALDESPINO MARTHA JULIETA' ,
83+ matricula : '2024783'
84+ } ,
85+ {
86+ nombre : 'PEÑA MUNGARRO LUIS ANGEL' ,
87+ matricula : '2066077'
88+ } ,
89+ {
90+ nombre : 'PUENTE REYNOSO JULIO CESAR' ,
91+ matricula : '2092151'
92+ } ,
93+ {
94+ nombre : 'RAMIREZ LOPEZ BRYAN' ,
95+ matricula : '2103708'
96+ } ,
97+ {
98+ nombre : 'RAMOS AVILA LILIANA VALERIA' ,
99+ matricula : '2115192'
100+ } ,
101+ {
102+ nombre : 'RICO JAUREGUI MAURICIO' ,
103+ matricula : '2037503'
104+ } ,
105+ {
106+ nombre : 'RIVERA LUNA ADRIAN' ,
107+ matricula : '2131513'
108+ } ,
109+ {
110+ nombre : 'RIVERA REYNA JOSE EMILIO' ,
111+ matricula : '2013503'
112+ } ,
113+ {
114+ nombre : 'RODRIGUEZ OLVERA ROSA ISELA' ,
115+ matricula : '2004613'
116+ } ,
117+ {
118+ nombre : 'RODRIGUEZ RODRIGUEZ ANGEL AZAEL' ,
119+ matricula : '2133022'
120+ } ,
121+ {
122+ nombre : 'SANCHEZ GALARZA JUAN CARLOS' ,
123+ matricula : '2026061'
124+ } ,
125+ {
126+ nombre : 'SOLIS ORTIZ ALFREDO' ,
127+ matricula : '2095320'
128+ } ,
129+ {
130+ nombre : 'VELAZQUEZ ABREGO HERWIN DANIEL' ,
131+ matricula : '2025350'
132+ } ,
133+ {
134+ nombre : 'VILLAGRA RODRIGUEZ ANDRES NEHUEL' ,
135+ matricula : '2103895'
136+ } ,
137+ {
138+ nombre : 'ZACATENCO OLIVE RODRIGO' ,
139+ matricula : '1857791'
140+ } ,
141+ {
142+ nombre : 'ZAVALA CANTU TERESA MARGARITA' ,
143+ matricula : '2025218'
144+ }
145+ ] ;
146+
147+ // Funcionalidad del Botón
148+ const [ mensaje , setMensaje ] = useState ( 'Toca un botón para saludar' ) ;
149+
150+ // Modificamos la función para que reciba el nombre del alumno
151+ const saludo = ( nombreDelAlumno ) => {
152+ setMensaje ( 'Hola, ' + nombreDelAlumno ) ;
153+ } ;
154+
155+ return (
156+ < SafeAreaView style = { estilos . container } >
157+ < StatusBar style = "auto" />
158+
159+ { /* Aquí mostramos el estado dinámico */ }
160+ < View style = { estilos . header } >
161+ < Text style = { estilos . textoMensaje } > { mensaje } </ Text >
162+ </ View >
163+
164+ < ScrollView contentContainerStyle = { estilos . contenido } >
165+ { alumnos . map ( ( alumno , index ) =>
166+ (
167+ < Alumno
168+ key = { index } // Usamos index para evitar el error de matrículas duplicadas
169+ nombre = { alumno . nombre }
170+ matricula = { alumno . matricula }
171+ // Le mandamos la función "saludo" al componente Alumno
172+ accionBoton = { ( ) => saludo ( alumno . nombre ) }
173+ />
174+ )
175+ ) }
176+ </ ScrollView >
177+ </ SafeAreaView >
178+ )
179+ }
180+
181+ const estilos = StyleSheet . create ( {
182+ container : {
183+ flex : 1 ,
184+ backgroundColor : '#fff' ,
185+ paddingTop : 40 ,
186+ } ,
187+ header : {
188+ backgroundColor : '#c1121f' ,
189+ padding : 20 ,
190+ alignItems : 'center' ,
191+ } ,
192+ textoMensaje : {
193+ color : '#fff' ,
194+ fontSize : 18 ,
195+ fontWeight : 'bold' ,
196+ } ,
197+ contenido : {
198+ paddingBottom : 20 ,
199+ }
200+ } ) ;
0 commit comments