:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import type { ReactElement } from 'react'
import { Pressable, StyleSheet } from 'react-native'
import Animated, { type SharedValue, useAnimatedStyle } from 'react-native-reanimated'
interface ScrimProps {
color: string
progress: SharedValue<number>
/** Omit to make the scrim swallow taps without closing anything. */
onPress?: () => void
accessibilityLabel?: string
}
export function Scrim({ color, progress, onPress, accessibilityLabel = 'Close' }: ScrimProps): ReactElement {
const animatedStyle = useAnimatedStyle(() => ({ opacity: progress.value }))
return (
<Animated.View style={[StyleSheet.absoluteFill, { backgroundColor: color }, animatedStyle]}>
<Pressable
style={StyleSheet.absoluteFill}
onPress={onPress}
disabled={!onPress}
accessibilityRole="button"
accessibilityLabel={accessibilityLabel}
importantForAccessibility={onPress ? 'yes' : 'no-hide-descendants'}
/>
</Animated.View>
)
}