暂无描述

account.js 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import * as React from 'react';
  2. import { Alert, View, Linking} from 'react-native';
  3. import { Button, Text, TextInput, Divider } from 'react-native-paper';
  4. import { useState, useCallback } from "react";
  5. import { NavigationContainer } from '@react-navigation/native';
  6. import { createNativeStackNavigator } from '@react-navigation/native-stack';
  7. import createAccount from './createAccount';
  8. import Header from '../shared/header';
  9. const supportedURL = "https://docs.google.com/forms/d/e/1FAIpQLSe93-cuCFQ084AxVbzhwFJHjtPhrXFJ624ezAcqKU5qUsBqwg/viewform";
  10. const submit = () => {
  11. console.log("write something")
  12. }
  13. const OpenURLButton = ({ url, children }) => {
  14. const handlePress = useCallback(async () => {
  15. // Checking if the link is supported for links with custom URL scheme.
  16. const supported = await Linking.canOpenURL(url);
  17. if (supported) {
  18. // Opening the link with some app, if the URL scheme is "http" the web link should be opened
  19. // by some browser in the mobile
  20. await Linking.openURL(url);
  21. } else {
  22. Alert.alert(`Don't know how to open this URL: ${url}`);
  23. }
  24. }, [url]);
  25. return <Button buttonColor = "purple"
  26. textColor= "white"
  27. style={{width: 250, marginVertical: 40, marginHorizontal: 90}}
  28. onPress={handlePress}>
  29. Llenar formulario de voluntario
  30. </Button> ;
  31. };
  32. const Stack = createNativeStackNavigator();
  33. const ProfileScreen = ({ route }) => {
  34. return (
  35. <View >
  36. <Text style={{fontSize:30, fontWeight:"bold", marginVertical: 20, marginHorizontal: 30}}>
  37. Mi Cuenta
  38. </Text>
  39. <Text style={{fontSize:15, fontWeight:"bold", marginVertical: 20, marginHorizontal: 30}}>
  40. Nombre: {route.params.userName}
  41. </Text>
  42. <Text style={{fontSize:15, fontWeight:"bold", marginVertical: 20, marginHorizontal: 30}}>
  43. Email: {route.params.email}
  44. </Text>
  45. <Text style={{fontSize:15, fontWeight:"bold", marginVertical: 20, marginHorizontal: 30}}>
  46. Telefono: {route.params.phone}
  47. </Text>
  48. <OpenURLButton
  49. url={"https://docs.google.com/forms/d/e/1FAIpQLSe93-cuCFQ084AxVbzhwFJHjtPhrXFJ624ezAcqKU5qUsBqwg/viewform"}>
  50. Llenar formulario de voluntario
  51. </OpenURLButton>
  52. </View>
  53. );
  54. };
  55. const MyComponent = () => {
  56. return (
  57. <NavigationContainer independent="true">
  58. <Stack.Navigator>
  59. <Stack.Screen name="CreateAccountScreen" component={createAccount} options={ ({navigation}) => {
  60. return {
  61. headerShown:false,
  62. headerTitle: () => <Header navigation={navigation}/>
  63. } }}/>
  64. <Stack.Screen name="Profile" component={ProfileScreen} />
  65. </Stack.Navigator>
  66. </NavigationContainer>
  67. );
  68. }
  69. export default MyComponent;