import { forwardRef, useMemo, type ComponentProps, type ReactElement, type ReactNode } from "react"; import { ScrollView, StyleSheet, type ScrollViewProps, type StyleProp, type View, type ViewStyle, } from "react-native"; import Animated from "react-native-reanimated"; import { inlineUnistylesStyle } from "@/styles/unistyles-inline-style"; export interface FloatingSurfaceProps extends Omit, "style"> { frameStyle?: StyleProp; style?: StyleProp; } export const FloatingSurface = forwardRef(function FloatingSurface( { frameStyle, style, ...props }, ref, ): ReactElement { const inlineFrameStyle = useMemo(() => { const flattened = StyleSheet.flatten(frameStyle); return flattened ? inlineUnistylesStyle(flattened) : undefined; }, [frameStyle]); const surfaceStyle = useMemo(() => [style, inlineFrameStyle], [inlineFrameStyle, style]); return ; }); export interface FloatingScrollViewProps { bounces?: boolean; children: ReactNode; contentContainerStyle?: StyleProp; keyboardShouldPersistTaps?: ScrollViewProps["keyboardShouldPersistTaps"]; showsVerticalScrollIndicator?: boolean; style?: StyleProp; } export function FloatingScrollView({ bounces, children, contentContainerStyle, keyboardShouldPersistTaps, showsVerticalScrollIndicator, style, }: FloatingScrollViewProps): ReactElement { const inlineStyle = useMemo(() => { const flattened = StyleSheet.flatten(style); return flattened ? inlineUnistylesStyle(flattened) : undefined; }, [style]); return ( {children} ); }