rm forwardRef

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