Skip to content

Commit e69de71

Browse files
authored
fix: Android context menu position offset (#1594)
1 parent 4465d64 commit e69de71

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

features/conversation-requests-list/conversation-requests-list-segment-controller.tsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ import {
44
textPrimaryColor,
55
} from "@styles/colors";
66
import React from "react";
7-
import { Text, TouchableOpacity, View, useColorScheme } from "react-native";
7+
import {
8+
Text,
9+
TouchableOpacity,
10+
View,
11+
useColorScheme,
12+
Platform,
13+
} from "react-native";
814

915
type IConversationRequestsListSegmentControllerProps = {
1016
options: string[];
@@ -24,7 +30,7 @@ export const ConversationRequestsListSegmentController: React.FC<
2430
backgroundColor: tertiaryBackgroundColor(colorScheme),
2531
borderRadius: 8,
2632
padding: 2,
27-
height: 32,
33+
height: Platform.OS === "android" ? 36 : 32,
2834
marginTop: 10,
2935
marginBottom: 2,
3036
marginHorizontal: 16,
@@ -36,7 +42,7 @@ export const ConversationRequestsListSegmentController: React.FC<
3642
style={[
3743
{
3844
flex: 1,
39-
paddingVertical: 6,
45+
paddingVertical: Platform.OS === "android" ? 4 : 6,
4046
alignItems: "center",
4147
justifyContent: "center",
4248
},
@@ -60,6 +66,7 @@ export const ConversationRequestsListSegmentController: React.FC<
6066
{
6167
fontSize: 13,
6268
color: textPrimaryColor(colorScheme),
69+
lineHeight: Platform.OS === "android" ? 18 : undefined,
6370
},
6471
index === selectedIndex && {
6572
fontWeight: "500",

features/conversation-requests-list/conversation-requests-list.screen.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const ConversationRequestsListScreen = memo(function () {
1919
return (
2020
<Screen contentContainerStyle={$globalStyles.flex1}>
2121
<ConversationRequestsListSegmentController
22-
options={[translate("you_might_know"), translate("hidden_requests")]}
22+
options={[translate("You might know"), translate("Hidden requests")]}
2323
selectedIndex={selectedSegment}
2424
onSelect={handleSegmentChange}
2525
/>

features/conversation/conversation-message/conversation-message-context-menu/conversation-message-context-menu-container.tsx

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { AnimatedVStack, VStack } from "@/design-system/VStack";
22
import { useConversationMessageContextMenuStyles } from "@/features/conversation/conversation-message/conversation-message-context-menu/conversation-message-context-menu.styles";
33
import { useAppTheme } from "@theme/useAppTheme";
44
import { memo, useEffect } from "react";
5+
import { Platform, StatusBar, useWindowDimensions } from "react-native";
56
import {
67
useAnimatedStyle,
78
useSharedValue,
@@ -12,7 +13,6 @@ import {
1213
MESSAGE_CONTEXT_MENU_ABOVE_MESSAGE_REACTIONS_HEIGHT,
1314
MESSAGE_CONTEXT_REACTIONS_HEIGHT,
1415
} from "./conversation-message-context-menu.constants";
15-
import { debugBorder } from "@/utils/debug-style";
1616

1717
export const MessageContextMenuContainer = memo(
1818
function MessageContextMenuContainer(args: {
@@ -30,6 +30,7 @@ export const MessageContextMenuContainer = memo(
3030
const translateYAV = useSharedValue(0);
3131
const { verticalSpaceBetweenSections } =
3232
useConversationMessageContextMenuStyles();
33+
const { height: windowHeight } = useWindowDimensions();
3334

3435
const {
3536
itemRectY,
@@ -43,7 +44,7 @@ export const MessageContextMenuContainer = memo(
4344
} = args;
4445

4546
useEffect(() => {
46-
const screenHeight = theme.layout.screen.height;
47+
const screenHeight = windowHeight;
4748
const minTopOffset =
4849
MESSAGE_CONTEXT_MENU_ABOVE_MESSAGE_REACTIONS_HEIGHT +
4950
verticalSpaceBetweenSections +
@@ -85,16 +86,22 @@ export const MessageContextMenuContainer = memo(
8586
theme,
8687
verticalSpaceBetweenSections,
8788
translateYAV,
89+
windowHeight,
8890
]);
8991

9092
const animatedStyle = useAnimatedStyle(() => ({
9193
transform: [{ translateY: translateYAV.value }],
9294
}));
9395

96+
// On Android, we need to account for the status bar height by moving the menu down
97+
const statusBarHeight =
98+
Platform.OS === "android" ? StatusBar.currentHeight || 0 : 0;
99+
94100
const distanceFromTop =
95101
itemRectY -
96102
MESSAGE_CONTEXT_MENU_ABOVE_MESSAGE_REACTIONS_HEIGHT -
97-
verticalSpaceBetweenSections;
103+
verticalSpaceBetweenSections +
104+
(Platform.OS === "android" ? statusBarHeight : 0);
98105

99106
return (
100107
<AnimatedVStack

i18n/translations/en.ts

-3
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,10 @@ export const en = {
230230
pending_count: "{{count}} pending",
231231

232232
// Requests
233-
requests: "Requests",
234233
clear_all: "Clear all",
235234
clear_confirm:
236235
"Do you confirm? This will block all accounts that are currently tagged as requests.",
237236
clearing: "Clearing",
238-
you_might_know: "You might know",
239-
hidden_requests: "Hidden requests",
240237
suggestion_text:
241238
"Based on your onchain history, we've made some suggestions on who you may know.",
242239
no_suggestions_text:

i18n/translations/fr.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,14 @@ export const fr = {
230230
pending_count: "{{count}} en attente",
231231

232232
// Requests
233-
requests: "Demandes",
233+
Requests: "Demandes",
234+
"You might know": "Vous pourriez connaître",
235+
"Hidden requests": "Demandes masquées",
236+
// Requests (to migrate from keys to plain english keys)
234237
clear_all: "Tout effacer",
235238
clear_confirm:
236239
"Confirmez-vous ? Cela bloquera tous les comptes actuellement marqués comme demandes.",
237240
clearing: "Nettoyage",
238-
you_might_know: "Vous pourriez connaître",
239-
hidden_requests: "Demandes masquées",
240241
suggestion_text:
241242
"Sur la base de votre historique on-chain, nous vous proposons quelques suggestions de personnes que vous pourriez connaître.",
242243
no_suggestions_text:

0 commit comments

Comments
 (0)