You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1.1 KiB

6 years ago
import React from "react"
import { View, StyleSheet, Dimensions, Image } from "react-native"
import { colors } from "../components/Variables"
6 years ago
const screen = Dimensions.get("window")
const styles = StyleSheet.create({
container: {
position: "absolute",
top: 0,
bottom: 0,
left: 0,
right: 0,
flex: 1,
alignItems: "center",
justifyContent: "center"
},
circle: {
6 years ago
backgroundColor: colors.red,
width: screen.width / 2,
height: screen.width / 2,
borderRadius: screen.width / 2,
alignItems: "center",
justifyContent: "center"
},
circleCorrect: {
6 years ago
backgroundColor: colors.green
},
icon: {
width: screen.width / 3
}
6 years ago
})
export const Alert = ({ correct, visible }) => {
6 years ago
if (!visible) return null
const icon = correct
? require("../assets/check.png")
6 years ago
: require("../assets/close.png")
6 years ago
const circleStyles = [styles.circle]
if (correct) {
6 years ago
circleStyles.push(styles.circleCorrect)
}
return (
<View style={styles.container}>
<View style={circleStyles}>
<Image source={icon} style={styles.icon} resizeMode="contain" />
</View>
</View>
6 years ago
)
}