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
| VStack { | |
| // 03/09/2023, 3:16 PM | |
| Text(Date.now.formatted()) | |
| // 3:17:05 PM | |
| Text(Date.now.formatted(date: .omitted, time: .standard)) | |
| // Mar 9, 2023 at 3:15:26 PM CST | |
| Text(Date.now.formatted(date: .abbreviated, time: .complete)) |
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 SwiftUI | |
| struct ValidatorViewModifier: ViewModifier { | |
| let value: String | |
| let field: LoginScreen.FormField | |
| @Binding var shouldValidate: Bool | |
| @Binding var validationResults: [LoginScreen.FormField: Bool] | |
| let validationRule: (String) -> String? | |
| @State private var errorMessage: 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
| import { AuthState } from "./AuthContext"; | |
| type AuthAction = { type: "login" } | { type: "logout" } | { type: "changeFavIcon"; payload: string } | { type: "changeUsername"; payload: string; img?: string }; | |
| export const authReducer = (state: AuthState, action: AuthAction): AuthState => { | |
| switch (action.type) { | |
| case "login": | |
| return { | |
| ...state, | |
| isLoggedIn: true, |
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 React, { createContext, useReducer } from "react"; | |
| import { authReducer } from "./authReducer"; | |
| // Definir como luce y que informacion tendra | |
| export interface AuthState { | |
| isLoggedIn: boolean; | |
| username?: string; | |
| imageUrl?: string; | |
| favoriteIcon?: 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
| import React, { createContext, useReducer } from "react"; | |
| import { authReducer } from "./authReducer"; | |
| // Definir como luce y que informacion tendra | |
| export interface AuthState { | |
| isLoggedIn: boolean; | |
| username?: string; | |
| imageUrl?: string; | |
| favoriteIcon?: 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
| export type ThemeAction = { type: "dark_theme_on" } | { type: "light_theme_on" }; | |
| export interface ThemeState { | |
| currentTheme: "light" | "dark"; | |
| dividerColor: string; | |
| dark: boolean; | |
| colors: { | |
| primary: string; | |
| background: string; | |
| card: 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
| // En la iterface solo agrega el tipo | |
| style?: StyleProp<ViewStyle> | |
| // Ejemplo: | |
| interface Props { | |
| imgUrl: string; | |
| style?: StyleProp<ViewStyle> | |
| } |
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
| // Implementaiton on ScrollView or Flat List | |
| <ScrollView | |
| refreshControl={ | |
| <RefreshControl | |
| refreshing={refreshing} | |
| onRefresh={onRefresh} | |
| progressBackgroundColor={'silver'} | |
| intColor={'purple'} | |
| style={{ |
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
| setTimeout(() => { | |
| ... | |
| }, 3000) |
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 React, { useState } from "react"; | |
| import { View, Switch, Text, StyleSheet } from "react-native"; | |
| import { BackButton } from "../../components/BackButton"; | |
| import { HeaderTitle } from "../../components/HeaderTitle"; | |
| import { CustomSwitch } from "../../components/CustomSwitch"; | |
| export const SwitchScreen = () => { | |
| const [state, setState] = useState({ | |
| isActive: true, | |
| isHungry: false, |