viettel-ekyc-sdk
Version:
49 lines • 1.56 kB
JavaScript
/* eslint-disable react-native/no-inline-styles */
import React from 'react';
import { Animated, Dimensions, Text } from 'react-native';
const initYPosition = Dimensions.get('screen').height / 2 - 25;
const animatedValue = new Animated.Value(-initYPosition);
let animation = animatedValue.interpolate({
inputRange: [0, 0.3, 1],
outputRange: [-70, -10, 0],
});
export const callToast = (afterToast) => {
Animated.timing(animatedValue, {
toValue: 1,
duration: 0,
useNativeDriver: true,
}).start(() => {
closeToast(afterToast);
});
};
const closeToast = (afterToast) => {
setTimeout(() => {
Animated.timing(animatedValue, {
toValue: -initYPosition,
duration: 0,
useNativeDriver: true,
}).start(() => afterToast());
}, 3000);
};
export const CustomeAlert = (props) => {
return (React.createElement(Animated.View, { style: {
transform: [{ translateY: animation }],
height: 50,
backgroundColor: 'white',
position: 'absolute',
left: 10,
top: initYPosition,
right: 10,
justifyContent: 'center',
zIndex: 10000,
borderRadius: 20,
} },
React.createElement(Text, { style: {
marginLeft: 10,
color: 'black',
fontSize: 16,
fontWeight: 'bold',
textAlign: 'center',
} }, props.message)));
};
//# sourceMappingURL=CustomeAlert.js.map