From 2db7ad8ef326c582c698d1f7248aae7dc5c2c423 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Wed, 22 Feb 2023 21:21:17 -0600 Subject: Fix ref forwarding in web --- src/view/com/util/Views.web.tsx | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/view/com/util/Views.web.tsx b/src/view/com/util/Views.web.tsx index c16070b2b..f00d3c072 100644 --- a/src/view/com/util/Views.web.tsx +++ b/src/view/com/util/Views.web.tsx @@ -33,10 +33,13 @@ export function CenteredView({ return } -export function FlatList({ - contentContainerStyle, - ...props -}: React.PropsWithChildren>) { +export const FlatList = React.forwardRef(function ( + { + contentContainerStyle, + ...props + }: React.PropsWithChildren>, + ref: React.Ref, +) { const theme = useTheme() contentContainerStyle = addStyle( contentContainerStyle, @@ -46,13 +49,19 @@ export function FlatList({ contentContainerStyle, theme.colorScheme === 'dark' ? styles.containerDark : styles.containerLight, ) - return -} + return ( + + ) +}) -export function ScrollView({ - contentContainerStyle, - ...props -}: React.PropsWithChildren) { +export const ScrollView = React.forwardRef(function ( + {contentContainerStyle, ...props}: React.PropsWithChildren, + ref: React.Ref, +) { const theme = useTheme() contentContainerStyle = addStyle( contentContainerStyle, @@ -63,9 +72,13 @@ export function ScrollView({ theme.colorScheme === 'dark' ? styles.containerDark : styles.containerLight, ) return ( - + ) -} +}) const styles = StyleSheet.create({ container: { -- cgit 1.4.1