Page MenuHomePhabricator

D9795.id32989.diff
No OneTemporary

D9795.id32989.diff

diff --git a/native/profile/keyserver-selection-bottom-sheet.react.js b/native/profile/keyserver-selection-bottom-sheet.react.js
--- a/native/profile/keyserver-selection-bottom-sheet.react.js
+++ b/native/profile/keyserver-selection-bottom-sheet.react.js
@@ -1,10 +1,13 @@
// @flow
+import invariant from 'invariant';
import * as React from 'react';
import { View, Text } from 'react-native';
+import { useSafeAreaInsets } from 'react-native-safe-area-context';
import type { KeyserverInfo } from 'lib/types/keyserver-types.js';
+import { BottomSheetContext } from '../bottom-sheet/bottom-sheet-provider.react.js';
import BottomSheet from '../bottom-sheet/bottom-sheet.react.js';
import Button from '../components/button.react.js';
import CommIcon from '../components/comm-icon.react.js';
@@ -34,11 +37,37 @@
const { goBack } = navigation;
+ const bottomSheetContext = React.useContext(BottomSheetContext);
+ invariant(bottomSheetContext, 'bottomSheetContext should be set');
+ const { setContentHeight } = bottomSheetContext;
+
+ const removeKeyserverContainerRef = React.useRef();
const bottomSheetRef = React.useRef();
const colors = useColors();
const styles = useStyles(unboundStyles);
+ const insets = useSafeAreaInsets();
+
+ const onLayout = React.useCallback(() => {
+ removeKeyserverContainerRef.current?.measure(
+ (x, y, width, height, pageX, pageY) => {
+ if (
+ height === null ||
+ height === undefined ||
+ pageY === null ||
+ pageY === undefined
+ ) {
+ return;
+ }
+ // header + paddingTop + paddingBottom + marginBottom
+ const keyserverHeaderHeight = 85 + 16 + 16 + 24;
+
+ setContentHeight(height + keyserverHeaderHeight + insets.bottom);
+ },
+ );
+ }, [insets.bottom, setContentHeight]);
+
const cloudIcon = React.useMemo(
() => (
<CommIcon
@@ -120,7 +149,9 @@
</View>
<Text style={styles.keyserverURLText}>{keyserverInfo.urlPrefix}</Text>
</View>
- {removeKeyserver}
+ <View ref={removeKeyserverContainerRef} onLayout={onLayout}>
+ {removeKeyserver}
+ </View>
</View>
</BottomSheet>
);

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 5:09 AM (21 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2496488
Default Alt Text
D9795.id32989.diff (2 KB)

Event Timeline