diff --git a/packages/app/src/components/ui/shortcut.tsx b/packages/app/src/components/ui/shortcut.tsx
index ec3d83e8f..e1499644f 100644
--- a/packages/app/src/components/ui/shortcut.tsx
+++ b/packages/app/src/components/ui/shortcut.tsx
@@ -1,4 +1,4 @@
-import type { ReactElement } from "react";
+import { useMemo, type ReactElement } from "react";
import { Text, View, type StyleProp, type TextStyle, type ViewStyle } from "react-native";
import { StyleSheet } from "react-native-unistyles";
import { formatShortcut, type ShortcutKey } from "@/utils/format-shortcut";
@@ -19,24 +19,28 @@ export function Shortcut({
const shortcutOs = getShortcutOs();
const singleCombo = displayChord[0];
+ const badgeStyle = useMemo(() => [styles.badge, style], [style]);
+ const textCombinedStyle = useMemo(() => [styles.text, textStyle], [textStyle]);
+ const sequenceStyle = useMemo(() => [styles.sequence, style], [style]);
+
if (!singleCombo) {
return ;
}
if (displayChord.length === 1) {
return (
-
- {formatShortcut(singleCombo, shortcutOs)}
+
+ {formatShortcut(singleCombo, shortcutOs)}
);
}
return (
-
+
{displayChord.map(function (combo, index) {
return (
- {formatShortcut(combo, shortcutOs)}
+ {formatShortcut(combo, shortcutOs)}
);
})}
diff --git a/packages/app/src/panels/agent-panel.tsx b/packages/app/src/panels/agent-panel.tsx
index abaaf4901..0cbd984bd 100644
--- a/packages/app/src/panels/agent-panel.tsx
+++ b/packages/app/src/panels/agent-panel.tsx
@@ -860,6 +860,11 @@ function ChatAgentContent({
shouldUseOptimisticStream,
]);
+ const animatedContentStyle = useMemo(
+ () => [styles.content, animatedKeyboardStyle],
+ [animatedKeyboardStyle],
+ );
+
if (viewState.tag === "not_found") {
return (
@@ -896,7 +901,7 @@ function ChatAgentContent({
-
+
[styles.inputAreaWrapper, { paddingBottom: insets.bottom }],
+ [insets.bottom],
+ );
+
return (
-
+
[
+ styles.content,
+ isCompact ? styles.contentCompact : styles.contentCentered,
+ isCompact ? { paddingBottom: insets.bottom } : null,
+ ],
+ [isCompact, insets.bottom],
+ );
+
+ const optionsRowStyle = useMemo(
+ () => [styles.optionsRow, keyboardAnimatedStyle],
+ [keyboardAnimatedStyle],
+ );
+
return (
-
+
-
+
diff --git a/packages/app/src/screens/settings/keyboard-shortcuts-section.tsx b/packages/app/src/screens/settings/keyboard-shortcuts-section.tsx
index f2ddf1417..1bb63ac35 100644
--- a/packages/app/src/screens/settings/keyboard-shortcuts-section.tsx
+++ b/packages/app/src/screens/settings/keyboard-shortcuts-section.tsx
@@ -1,4 +1,4 @@
-import { useState, useEffect } from "react";
+import { useEffect, useMemo, useState } from "react";
import { View, Text } from "react-native";
import { useIsFocused } from "@react-navigation/native";
import { StyleSheet } from "react-native-unistyles";
@@ -23,6 +23,8 @@ import { getShortcutOs } from "@/utils/shortcut-platform";
import { getIsElectronRuntime } from "@/constants/layout";
import { isNative } from "@/constants/platform";
+const EMPTY_CAPTURED_COMBOS: string[] = [];
+
function ShortcutSequence({
chord,
heldModifiers,
@@ -30,16 +32,19 @@ function ShortcutSequence({
chord: string[] | null;
heldModifiers: string | null;
}) {
+ const displayChord = useMemo(() => {
+ const combos = [...(chord ?? [])];
+ if (heldModifiers) {
+ combos.push(heldModifiers);
+ }
+ return combos.map(comboStringToShortcutKeys);
+ }, [chord, heldModifiers]);
+
if ((!chord || chord.length === 0) && !heldModifiers) {
return Press shortcut...;
}
- const displayCombos = [...(chord ?? [])];
- if (heldModifiers) {
- displayCombos.push(heldModifiers);
- }
-
- return ;
+ return ;
}
function ShortcutRow({
@@ -65,10 +70,17 @@ function ShortcutRow({
onCancel: () => void;
onReset: () => void;
}) {
- const displayChord = overrideCombo ? chordStringToShortcutKeys(overrideCombo) : [row.keys];
+ const displayChord = useMemo(
+ () => (overrideCombo ? chordStringToShortcutKeys(overrideCombo) : [row.keys]),
+ [overrideCombo, row.keys],
+ );
+ const rowStyle = useMemo(
+ () => [styles.row, isCapturing && styles.rowCapturing],
+ [isCapturing],
+ );
return (
-
+
{row.label}
{isCapturing ? (
@@ -178,7 +190,7 @@ export function KeyboardShortcutsSection() {
if (isNative) {
return (
-
+
Keyboard shortcuts are only available on desktop
@@ -215,7 +227,9 @@ export function KeyboardShortcutsSection() {
bindingId={bindingId}
overrideCombo={overrideCombo}
isCapturing={capturingBindingId === bindingId}
- capturedCombos={capturingBindingId === bindingId ? capturedCombos : []}
+ capturedCombos={
+ capturingBindingId === bindingId ? capturedCombos : EMPTY_CAPTURED_COMBOS
+ }
heldModifiers={capturingBindingId === bindingId ? heldModifiers : null}
onRebind={() => {
if (bindingId) {
@@ -280,3 +294,5 @@ const styles = StyleSheet.create((theme) => ({
color: theme.colors.foregroundMuted,
},
}));
+
+const mobileCardStyle = [settingsStyles.card, styles.mobileCard];