Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.2 kB
0
Indexable
Never
import { createContext, useState } from "react"
import AwesomeAlert from 'react-native-awesome-alerts';
import * as Animatable from 'react-native-animatable';
import { ActivityIndicator } from 'react-native';

export const AppContext = createContext()

export const AppContextProvider = ({ children }) => {

  const [isLoading, setIsLoading] = useState(false);

    const [alert, setAlert] = useState({
        text: '',
        type: null,
        show: false,
        title: '',
        cancelButton: false,
        confirmButton: true,
        cargando: false
    })
    const aliveAlert = () => {
        return (
          <View style={styles.container}>
          <View style={styles.loadingContainer}>
          {isLoading && (
            <Animatable.View animation="bounce" style={styles.loadingContainer}>
              <ActivityIndicator size="large" color="#ffffff" />
              <Text style={styles.loadingText}> {strings.TransferenciaEnCurso}</Text>
            </Animatable.View>
          )}
          </View>
        </View>
          
        )
    }

    return <AppContext.Provider value={{aliveAlert, setIsLoading,isLoading }}>
        {children}
    </AppContext.Provider>
}