29 lines
615 B
TypeScript
29 lines
615 B
TypeScript
import { View, Text } from "react-native";
|
|
|
|
interface MessageDisplayProps {
|
|
message: string;
|
|
type: "error" | "success";
|
|
}
|
|
|
|
export const MessageDisplay = ({ message, type }: MessageDisplayProps) => {
|
|
if (!message) return null;
|
|
|
|
const backgroundColor =
|
|
type === "error" ? "rgba(255,0,0,0.1)" : "rgba(0,255,0,0.1)";
|
|
|
|
const textColor = type === "error" ? "#F83434" : "#22C927";
|
|
|
|
return (
|
|
<View
|
|
style={{
|
|
marginBottom: 16,
|
|
padding: 10,
|
|
backgroundColor,
|
|
borderRadius: 4,
|
|
}}
|
|
>
|
|
<Text style={{ color: textColor }}>{message}</Text>
|
|
</View>
|
|
);
|
|
};
|