// components/MazeedPlacementWebView.tsx (Enhanced)
import React, { useMemo, useState } from "react";
import { WebView } from "react-native-webview";
import { View, ActivityIndicator, StyleSheet } from "react-native";
type Props = {
html: string; // Full HTML document from API
};
export const MazeedPlacementWebView: React.FC<Props> = ({ html }) => {
const [isLoaded, setIsLoaded] = useState(false);
if (!html) return null;
return (
<View style={styles.container}>
{!isLoaded && (
<View style={styles.loaderContainer}>
<ActivityIndicator size="large" color="#0000ff" />
</View>
)}
<WebView
originWhitelist={["*"]}
source={{ html }}
onLoadEnd={() => setIsLoaded(true)}
style={[styles.webview, !isLoaded && styles.hidden]}
/>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
loaderContainer: {
...StyleSheet.absoluteFillObject,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#ffffff",
},
webview: {
flex: 1,
},
hidden: {
opacity: 0,
},
});