import { BottomSheetScrollView as GorhomBottomSheetScrollView } from '@gorhom/bottom-sheet' import React, { useState } from 'react' import { LayoutChangeEvent, StyleProp, StyleSheet, View, ViewStyle } from 'react-native' import { ScrollView } from 'react-native-gesture-handler' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { Spacing } from 'src/styles/styles' interface Props { containerStyle?: StyleProp testId?: string forwardedRef?: React.RefObject children: React.ReactNode } function BottomSheetScrollView({ forwardedRef, containerStyle, testId, children }: Props) { const [containerHeight, setContainerHeight] = useState(0) const [contentHeight, setContentHeight] = useState(0) const insets = useSafeAreaInsets() const scrollEnabled = contentHeight > containerHeight return ( { setContainerHeight(event.nativeEvent.layout.height) }} keyboardShouldPersistTaps="always" > { setContentHeight(event.nativeEvent.layout.height) }} testID={testId} > {children} ) } const styles = StyleSheet.create({ container: { padding: Spacing.Thick24, }, }) export default BottomSheetScrollView