rm forwardRef

This commit is contained in:
Samuel Newman
2025-11-03 11:17:44 +02:00
parent d7750c778f
commit 55a7f03b29
+37 -43
View File
@@ -1,12 +1,9 @@
import {forwardRef, memo, useContext, useMemo} from 'react' import {memo, useContext, useMemo} from 'react'
import { import {
ScrollView, ScrollView,
type ScrollViewProps, type ScrollViewProps,
<<<<<<< HEAD
type StyleProp, type StyleProp,
=======
StyleSheet, StyleSheet,
>>>>>>> c74c5a431 (Revert "rm stylesheet")
View, View,
type ViewProps, type ViewProps,
type ViewStyle, type ViewStyle,
@@ -60,51 +57,48 @@ export const Screen = memo(function Screen({
}) })
export type ContentProps = ScrollViewProps & { export type ContentProps = ScrollViewProps & {
ref?: React.Ref<ScrollView>
ignoreTabletLayoutOffset?: boolean ignoreTabletLayoutOffset?: boolean
} }
/** /**
* Default scroll view for simple pages * Default scroll view for simple pages
*/ */
export const Content = memo( export const Content = memo(function Content({
forwardRef<ScrollView, ContentProps>(function Content( ref,
{ children,
children, style,
style, contentContainerStyle,
contentContainerStyle, ignoreTabletLayoutOffset,
ignoreTabletLayoutOffset, ...props
...props }: ContentProps) {
}, const t = useTheme()
ref, const {footerHeight} = useShellLayout()
) {
const t = useTheme()
const {footerHeight} = useShellLayout()
return ( return (
<ScrollView <ScrollView
ref={ref} ref={ref}
id="content" id="content"
automaticallyAdjustsScrollIndicatorInsets={false} automaticallyAdjustsScrollIndicatorInsets={false}
scrollIndicatorInsets={{bottom: footerHeight, top: 0, right: 1}} scrollIndicatorInsets={{bottom: footerHeight, top: 0, right: 1}}
indicatorStyle={t.scheme === 'dark' ? 'white' : 'black'} indicatorStyle={t.scheme === 'dark' ? 'white' : 'black'}
style={[scrollViewStyles.common, style]} style={[scrollViewStyles.common, style]}
contentInset={ios({top: 0, left: 0, bottom: footerHeight, right: 0})} contentInset={ios({top: 0, left: 0, bottom: footerHeight, right: 0})}
contentContainerStyle={[ contentContainerStyle={[
!IS_IOS && {paddingBottom: footerHeight}, !IS_IOS && {paddingBottom: footerHeight},
contentContainerStyle, contentContainerStyle,
]} ]}
{...props}> {...props}>
{IS_WEB ? ( {IS_WEB ? (
<Center ignoreTabletLayoutOffset={ignoreTabletLayoutOffset}> <Center ignoreTabletLayoutOffset={ignoreTabletLayoutOffset}>
{children} {children}
</Center> </Center>
) : ( ) : (
children children
)} )}
</ScrollView> </ScrollView>
) )
}), })
)
const scrollViewStyles = StyleSheet.create({ const scrollViewStyles = StyleSheet.create({
common: { common: {
@@ -136,7 +130,7 @@ export const KeyboardAwareContent = memo(function LayoutKeyboardAwareContent({
scrollIndicatorInsets={{bottom: footerHeight, top: 0, right: 1}} scrollIndicatorInsets={{bottom: footerHeight, top: 0, right: 1}}
contentInset={ios({top: 0, left: 0, bottom: footerHeight, right: 0})} contentInset={ios({top: 0, left: 0, bottom: footerHeight, right: 0})}
contentContainerStyle={[ contentContainerStyle={[
!isIOS && {paddingBottom: footerHeight}, !IS_IOS && {paddingBottom: footerHeight},
contentContainerStyle, contentContainerStyle,
]} ]}
keyboardShouldPersistTaps="handled" keyboardShouldPersistTaps="handled"