diff --git a/native/bottom-sheet/bottom-sheet-provider.react.js b/native/bottom-sheet/bottom-sheet-provider.react.js new file mode 100644 --- /dev/null +++ b/native/bottom-sheet/bottom-sheet-provider.react.js @@ -0,0 +1,38 @@ +// @flow + +import * as React from 'react'; + +import type { SetState } from 'lib/types/hook-types.js'; + +export type BottomSheetContextType = { + +contentHeight: number, + +setContentHeight: SetState, +}; + +const BottomSheetContext: React.Context = + React.createContext(); + +type Props = { + +children: React.Node, +}; +function BottomSheetProvider(props: Props): React.Node { + const { children } = props; + + const [contentHeight, setContentHeight] = React.useState(1); + + const context = React.useMemo( + () => ({ + contentHeight, + setContentHeight, + }), + [contentHeight], + ); + + return ( + + {children} + + ); +} + +export { BottomSheetContext, BottomSheetProvider }; diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -27,6 +27,7 @@ import { RegistrationContextProvider } from './account/registration/registration-context-provider.react.js'; import NativeEditThreadAvatarProvider from './avatars/native-edit-thread-avatar-provider.react.js'; import BackupHandler from './backup/backup-handler.js'; +import { BottomSheetProvider } from './bottom-sheet/bottom-sheet-provider.react.js'; import ChatContextProvider from './chat/chat-context-provider.react.js'; import MessageEditingContextProvider from './chat/message-editing-context-provider.react.js'; import { FeatureFlagsProvider } from './components/feature-flags-provider.react.js'; @@ -279,23 +280,25 @@ - - - - - {gated} - - - - - {navigation} - + + + + + + {gated} + + + + + {navigation} + +