Ingen beskrivning

TopBarNavigator.js 8.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. //Nathalia A. Alicea
  2. //código para la implementación de los Tabs y las pantalla de "Sobre Nosotros", "Insignia", "Tienda" y "Contacto"
  3. import * as React from 'react';
  4. import {useState, useEffect} from 'react';
  5. import {Text, View, Button, Linking, Image, FlatList, TextInput, StyleSheet, ScrollView } from 'react-native';
  6. import { NavigationContainer } from '@react-navigation/native';
  7. import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
  8. import { useSafeAreaInsets } from 'react-native-safe-area-context';
  9. //Json que se están usando como ejemplo de lo que se usaría con una API
  10. //import JsonNosotros from '../nosotros.json'
  11. //import insignias from '../insignias.json'
  12. import HomeScreen from '../codes/screen/Homescreen/index';
  13. import fetch_json from '../fetch_json';
  14. //función con código para la pantalla de "Sobre Nosotros" donde la data se extrae de Json files.
  15. function Nosotros() {
  16. const [jsonNosotros, setNosotros] = useState([]);
  17. const url = 'http://136.145.231.41/raices_api/api/nosotros/read.php?id=2';
  18. useEffect(() => {
  19. fetch_json(url, setNosotros);
  20. });
  21. return (
  22. <View style = {{
  23. flex:1,
  24. alignItems: "center",
  25. justifyContent: "space-evenly",
  26. backgroundColor: "#efffea"}}
  27. >
  28. <Text></Text>
  29. <Image style = {{width: 260, height: 130}} source={require('../image/logowebes.png')}/>
  30. <Text></Text>
  31. <Text></Text>
  32. <ScrollView>
  33. {jsonNosotros.map((item)=>{
  34. return (
  35. <View key ={item.key} >
  36. <Image style = {styles.image} source={{uri: item.imagen}} />
  37. <Text style={styles.item}>{item.nombre} {item.apellido} </Text>
  38. <Text style={styles.itemLetters}>{item.descripcion}</Text>
  39. <Text></Text>
  40. </View>
  41. )
  42. })}
  43. </ScrollView>
  44. <ScrollView>
  45. <View >
  46. <View>
  47. <Text style={styles.itemMVV}>Misión</Text>
  48. <Text style={styles.itemLettersMVV}>Aportar a la transformación hacia la sostenibilidad a nivel individual, empresarial y organizacional a través de la educación y de la promoción y validación de negocios locales que venden productos o servicios sostenibles.</Text>
  49. </View>
  50. <View>
  51. <Text style={styles.itemMVV}>Visión</Text>
  52. <Text style={styles.itemLettersMVV}>Ser reconocidos globalmente como una organización educativa con confiabilidad y compromiso con la educación sobre la sostenibilidad y la promoción y validación de productos y servicios sostenibles locales, destacando y contribuyendo al bienestar de la ciudadanía, el desarrollo económico local, el comercio justo y la conservación del ambiente.</Text>
  53. </View>
  54. <View>
  55. <Text style={styles.itemMVV}>Valores</Text>
  56. <Text style={styles.itemLettersMVV}>Educación, Respeto y responsabilidad social y ambiental, Comercio justo, Confiabilidad, Disciplina, Empatía y solidaridad, Equidad, Honestidad, Humanidad y respeto, Integridad y objetividad</Text>
  57. </View>
  58. </View>
  59. </ScrollView>
  60. </View>
  61. );
  62. }
  63. //función donde se extraen las insignias y las descripciones de las mismas y se muestran en el tab de "Insignias".
  64. function Logos() {
  65. const [jsonInsignias, setInsignias] = useState([]);
  66. const url = 'http://136.145.231.41/raices_api/api/nosotros/read.php?id=1';
  67. useEffect(() => {
  68. fetch_json(url, setInsignias);
  69. });
  70. return (
  71. <View style = {{
  72. flex:1,
  73. alignItems: "center",
  74. justifyContent: "space-evenly",
  75. backgroundColor: "#efffea"}}
  76. >
  77. <Text></Text>
  78. <Image style = {{width: 260, height: 130}} source={require('../image/logowebes.png')}/>
  79. <Text></Text>
  80. <Text></Text>
  81. <ScrollView>
  82. {jsonInsignias.map((item)=>{
  83. return (
  84. <View key ={item.id} >
  85. <Image style = {styles.image} source={{uri: item.imagen}} />
  86. <Text style={styles.description}>{item.nombre} </Text>
  87. <Text></Text>
  88. </View>
  89. )
  90. })}
  91. </ScrollView>
  92. </View>
  93. );
  94. }
  95. //función para Tienda.
  96. function Tienda() {
  97. return (
  98. <View style={{
  99. flex: 1,
  100. justifyContent: "center",
  101. alignItems: "center",
  102. backgroundColor: "#efffea"
  103. }}>
  104. <HomeScreen />
  105. </View>
  106. );
  107. }
  108. //función donde los clientes o personas interesadas pueden escribir un email a raices.
  109. function Contacto() {
  110. return (
  111. <View style = {{
  112. flex:1,
  113. alignItems: "center",
  114. justifyContent: "space-evenly",
  115. backgroundColor: "#efffea"}}>
  116. <Image style = {{width: 260, height: 130}} source={require('../image/logowebes.png')}/>
  117. <Text style={{ fontSize: 20, color: '#2d4b09', fontWeight: '800' }}>Para solicitudes o reclamos: </Text>
  118. <View style={{padding:20}}>
  119. <Text style={{ fontSize: 10, color: '#4c5b4b', fontWeight: '500' }}>
  120. Con el próposito de poder comunicarnos de la manera más efectiva posible, favor de proveer la siguiente información: propósito de comunicación, nombre, apellido y correo electrónico. Nos estaremos comunicando con usted prontamente.
  121. </Text>
  122. <Button onPress={() => Linking.openURL('mailto:contacto@raices.com?subject=SendMail&body=Favor de incluir motivo de comunicación e información personal.') } title="Contáctanos!" color="#2d4b09" />
  123. </View>
  124. </View>
  125. );
  126. }
  127. //estilos de stylesheets
  128. const styles = StyleSheet.create({
  129. image:{
  130. flex:2,
  131. height: 150,
  132. resizeMode: "contain"
  133. },
  134. container: {
  135. flex: 1,
  136. backgroundColor:'#58AB63',
  137. paddingTop:40,
  138. paddingHorizontal: 20,
  139. },
  140. item: {
  141. marginTop:30,
  142. padding:10,
  143. backgroundColor: '#77aa5a',
  144. fontSize: 20,
  145. color: "#fff",
  146. justifyContent: "flex-end"
  147. },
  148. description: {
  149. padding:10,
  150. backgroundColor: '#77aa5a',
  151. fontSize: 20,
  152. color: "#fff",
  153. textAlign: "center",
  154. alignItems: "stretch"
  155. },
  156. itemLetters: {
  157. padding: 30,
  158. backgroundColor: '#77aa5a',
  159. fontSize: 10,
  160. color: "#fff",
  161. justifyContent: "flex-start"
  162. },
  163. itemMVV:{
  164. padding: 10,
  165. fontSize: 15,
  166. color: "green"},
  167. itemLettersMVV: {
  168. padding: 10,
  169. fontSize: 10,
  170. color: "#77aa5a",
  171. justifyContent: "flex-start"
  172. }
  173. });
  174. const Tab = createMaterialTopTabNavigator();
  175. //todas las pantalla de los tabs.
  176. function MyTabs() {
  177. const insets = useSafeAreaInsets();
  178. return (
  179. <Tab.Navigator screenOptions ={{ style: { backgroundColor: "white", marginTop: insets.top }, activeTintColor: "#228B22", labelStyle: { fontSize: 12 } }}>
  180. <Tab.Screen name="Sobre Nosotros"
  181. component={Nosotros}
  182. options={{ tabBarLabel: 'Sobre Nosotros' }}
  183. />
  184. <Tab.Screen name="Insignias"
  185. component={Logos}
  186. options={{ tabBarLabel: 'Insignias' }}
  187. />
  188. <Tab.Screen name="Tienda"
  189. component={Tienda}
  190. options={{ tabBarLabel: 'Tienda' }}
  191. />
  192. <Tab.Screen name="Contacto"
  193. component={Contacto}
  194. options={{ tabBarLabel: 'Contacto' }}
  195. />
  196. </Tab.Navigator>
  197. );
  198. }
  199. export default function TopTabNavigator() {
  200. return (
  201. <NavigationContainer>
  202. <MyTabs />
  203. </NavigationContainer>
  204. )
  205. }