rn-inkpad
Version:
<img src="https://res.cloudinary.com/fercloudinary/image/upload/v1715452841/packages/inkpad-banner_acl0xl.png" />
39 lines (38 loc) • 1.56 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Toast = void 0;
const react_1 = __importDefault(require("react"));
const react_native_1 = require("react-native");
const hooks_1 = require("../../hooks");
const Icon_1 = require("../icon/Icon");
const Toast = ({ backgroundColor = 'rgba(0,0,0,0.7)', duration = 3000, bottom = 30, top = 50, fontSize = 14, icon, setVisible, position = 'top', text, textColor = '#FFF', visible, }) => {
const { show, translateY } = (0, hooks_1.useToast)(visible, duration, position, setVisible);
if (!show)
return null;
return (<react_native_1.Animated.View style={[
styles.container,
{ backgroundColor },
{ transform: [{ translateY: translateY }] },
position === 'top' ? { top } : { bottom },
]}>
{!!icon && <Icon_1.Icon name={icon} color={textColor} size={fontSize + 2}/>}
{!!text && <react_native_1.Text style={{ color: textColor, fontSize }}>{text}</react_native_1.Text>}
</react_native_1.Animated.View>);
};
exports.Toast = Toast;
const styles = react_native_1.StyleSheet.create({
container: {
alignContent: 'center',
alignItems: 'center',
borderRadius: 50,
flexDirection: 'row',
gap: 5,
justifyContent: 'center',
padding: 10,
paddingHorizontal: 15,
position: 'absolute',
},
});