Page MenuHomePhabricator

D9272.id31533.diff
No OneTemporary

D9272.id31533.diff

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<number>,
+};
+
+const BottomSheetContext: React.Context<?BottomSheetContextType> =
+ React.createContext<?BottomSheetContextType>();
+
+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 (
+ <BottomSheetContext.Provider value={context}>
+ {children}
+ </BottomSheetContext.Provider>
+ );
+}
+
+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';
@@ -280,23 +281,25 @@
<NativeEditThreadAvatarProvider>
<MarkdownContextProvider>
<MessageSearchProvider>
- <RegistrationContextProvider>
- <SQLiteDataHandler />
- <ConnectedStatusBar />
- <ReduxPersistGate
- persistor={getPersistor()}
- >
- {gated}
- </ReduxPersistGate>
- <PersistedStateGate>
- <Socket
- detectUnsupervisedBackgroundRef={
- detectUnsupervisedBackgroundRef
- }
- />
- </PersistedStateGate>
- {navigation}
- </RegistrationContextProvider>
+ <BottomSheetProvider>
+ <RegistrationContextProvider>
+ <SQLiteDataHandler />
+ <ConnectedStatusBar />
+ <ReduxPersistGate
+ persistor={getPersistor()}
+ >
+ {gated}
+ </ReduxPersistGate>
+ <PersistedStateGate>
+ <Socket
+ detectUnsupervisedBackgroundRef={
+ detectUnsupervisedBackgroundRef
+ }
+ />
+ </PersistedStateGate>
+ {navigation}
+ </RegistrationContextProvider>
+ </BottomSheetProvider>
</MessageSearchProvider>
</MarkdownContextProvider>
</NativeEditThreadAvatarProvider>

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 22, 12:32 AM (16 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2559211
Default Alt Text
D9272.id31533.diff (4 KB)

Event Timeline