diff --git a/packages/ondevice-controls/package.json b/packages/ondevice-controls/package.json index d464c11a0b..97772390d0 100644 --- a/packages/ondevice-controls/package.json +++ b/packages/ondevice-controls/package.json @@ -50,7 +50,8 @@ "@react-native-community/datetimepicker": "*", "@react-native-community/slider": "*", "react": "*", - "react-native": "*" + "react-native": "*", + "@gorhom/bottom-sheet": ">=4" }, "publishConfig": { "access": "public" diff --git a/packages/ondevice-controls/src/types/Array.tsx b/packages/ondevice-controls/src/types/Array.tsx index 272be399da..dad0784350 100644 --- a/packages/ondevice-controls/src/types/Array.tsx +++ b/packages/ondevice-controls/src/types/Array.tsx @@ -3,8 +3,9 @@ import { styled } from '@storybook/react-native-theming'; import { inputStyle } from './common'; import { useResyncValue } from './useResyncValue'; +import { BottomSheetTextInput } from '@gorhom/bottom-sheet'; -const Input = styled.TextInput(({ theme }) => ({ +const Input = styled(BottomSheetTextInput)(({ theme }) => ({ ...inputStyle(theme), })); diff --git a/packages/ondevice-controls/src/types/Number.tsx b/packages/ondevice-controls/src/types/Number.tsx index 24445f0df7..2c1fd53f2c 100644 --- a/packages/ondevice-controls/src/types/Number.tsx +++ b/packages/ondevice-controls/src/types/Number.tsx @@ -5,8 +5,9 @@ import { View } from 'react-native'; import { inputStyle } from './common'; import { useResyncValue } from './useResyncValue'; +import { BottomSheetTextInput } from '@gorhom/bottom-sheet'; -const Input = styled.TextInput<{ showError: boolean }>(({ theme, showError }) => { +const Input = styled(BottomSheetTextInput)<{ showError: boolean }>(({ theme, showError }) => { const style = inputStyle(theme); return { ...style, diff --git a/packages/ondevice-controls/src/types/Object.tsx b/packages/ondevice-controls/src/types/Object.tsx index 691f02f4ef..14612564eb 100644 --- a/packages/ondevice-controls/src/types/Object.tsx +++ b/packages/ondevice-controls/src/types/Object.tsx @@ -4,6 +4,7 @@ import { ViewStyle } from 'react-native'; import { useResyncValue } from './useResyncValue'; import { inputStyle } from './common'; +import { BottomSheetTextInput } from '@gorhom/bottom-sheet'; export interface ObjectProps { arg: { @@ -14,7 +15,7 @@ export interface ObjectProps { isPristine: boolean; } -const Input = styled.TextInput(({ theme }) => ({ +const Input = styled(BottomSheetTextInput)(({ theme }) => ({ ...inputStyle(theme, false), minHeight: 60, })); diff --git a/packages/ondevice-controls/src/types/Text.tsx b/packages/ondevice-controls/src/types/Text.tsx index b261773bba..47bc9e820d 100644 --- a/packages/ondevice-controls/src/types/Text.tsx +++ b/packages/ondevice-controls/src/types/Text.tsx @@ -1,5 +1,6 @@ import React from 'react'; import { styled } from '@storybook/react-native-theming'; +import { BottomSheetTextInput } from '@gorhom/bottom-sheet'; import { inputStyle } from './common'; import { useResyncValue } from './useResyncValue'; @@ -14,7 +15,7 @@ export interface TextProps { isPristine: boolean; } -const Input = styled.TextInput(({ theme }) => ({ +const Input = styled(BottomSheetTextInput)(({ theme }) => ({ ...inputStyle(theme), })); diff --git a/packages/react-native-ui/src/Layout.tsx b/packages/react-native-ui/src/Layout.tsx index e883b04649..c3740076a9 100644 --- a/packages/react-native-ui/src/Layout.tsx +++ b/packages/react-native-ui/src/Layout.tsx @@ -15,8 +15,8 @@ import { BottomSheetScrollView, } from '@gorhom/bottom-sheet'; import { ReactNode, forwardRef, useImperativeHandle, useRef, useState } from 'react'; -import { Keyboard, Platform, ScrollView, Text, View } from 'react-native'; -import { useAnimatedKeyboard, useReducedMotion } from 'react-native-reanimated'; +import { Keyboard, Text, View } from 'react-native'; +import { useReducedMotion } from 'react-native-reanimated'; // import { Button } from './Button'; import { IconButton } from './IconButton'; import { MenuIcon } from './icon/MenuIcon'; @@ -27,6 +27,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { ReactRenderer } from '@storybook/react'; import { Button as Button2 } from './Button'; import { CloseIcon } from './icon/CloseIcon'; +import { ScrollView } from 'react-native-gesture-handler'; const BottomSheetBackdropComponent = (backdropComponentProps: BottomSheetBackdropProps) => ( ( ({ children }, ref) => { - const keyboard = useAnimatedKeyboard(); const [isMobileMenuOpen, setMobileMenuOpen] = useState(false); const reducedMotion = useReducedMotion(); @@ -99,18 +99,12 @@ const MobileMenuDrawer = forwardRef - + {children} @@ -161,14 +155,17 @@ const MobileAddonsPanel = forwardRef style={{ paddingTop: 8, }} + containerStyle={{}} backgroundStyle={{ borderRadius: 0, borderTopColor: 'lightgrey', borderTopWidth: 1, }} + keyboardBehavior="interactive" + keyboardBlurBehavior="restore" enableDismissOnClose - enableHandlePanningGesture - enableContentPanningGesture + enableHandlePanningGesture={true} + enableContentPanningGesture={true} // enablePanDownToClose={false} stackBehavior="replace" // backdropComponent={BottomSheetBackdropComponent} @@ -209,6 +206,7 @@ const MobileAddonsPanel = forwardRef /> (null); // const fullStoryName = useFullStoryName(); const insets = useSafeAreaInsets(); + return ( {children} diff --git a/packages/react-native-ui/src/Search.tsx b/packages/react-native-ui/src/Search.tsx index b7dde0f29e..a7470d70d8 100644 --- a/packages/react-native-ui/src/Search.tsx +++ b/packages/react-native-ui/src/Search.tsx @@ -27,6 +27,7 @@ import { SearchIcon } from './icon/SearchIcon'; import { CloseIcon } from './icon/CloseIcon'; import { TextInput, View } from 'react-native'; import { DEFAULT_REF_ID } from './constants'; +import { BottomSheetTextInput } from '@gorhom/bottom-sheet'; const DEFAULT_MAX_SEARCH_RESULTS = 50; @@ -67,7 +68,7 @@ const SearchField = styled.View({ // marginBottom: 16, }); -const Input = styled.TextInput(({ theme }) => ({ +const Input = styled(BottomSheetTextInput)(({ theme }) => ({ // appearance: 'none', height: 32, paddingLeft: 28, @@ -304,7 +305,7 @@ export const Search = React.memo<{ setIsOpen(true)} onBlur={() => setIsOpen(false)}