Skip to content
TypeScript

fix(mobile): approval card buttons line up (#31415)

shivame71e4d2a020c
diff --git a/apps/mobile/src/features/threads/PendingApprovalCard.tsx b/apps/mobile/src/features/threads/PendingApprovalCard.tsx
index b5a9d4ed27e..f9ec44d5d4e 100644
--- a/apps/mobile/src/features/threads/PendingApprovalCard.tsx
+++ b/apps/mobile/src/features/threads/PendingApprovalCard.tsx
@@ -80,7 +80,7 @@ export function PendingApprovalCard(props: PendingApprovalCardProps) {
{warning ? (
<Text className="font-sans text-xs leading-normal text-warning-foreground">{warning}</Text>
) : null}
- <View className="flex-row flex-wrap gap-2.5">
+ <View className="gap-2">
{options.map((option) => (
<Button
key={option.decision}
@@ -94,6 +94,7 @@ export function PendingApprovalCard(props: PendingApprovalCardProps) {
}
disabled={disabled || !props.canOperateThread}
onPress={() => void props.onRespond(props.approval.requestId, option.decision)}
+ fullWidth
/>
))}
</View>
diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
index 0d3258dd3be..9a470e7c4bf 100644
--- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx
@@ -1019,6 +1019,16 @@ function ThreadDetailBody(
maxHeight: pendingUserInputMaxHeight.value,
flexGrow: 0,
}));
+ // Questions overlay the composer on iOS; an approval sits above it, so it gives up its height.
+ const approvalHeightStyle = useAnimatedStyle(() => ({
+ maxHeight: derivePendingUserInputMaxHeight({
+ windowHeight: screenAreaHeight,
+ keyboardHeight: keyboardStickyEnabled ? -keyboardTranslation.value : 0,
+ navigationHeaderHeight,
+ composerOverlapHeight,
+ }),
+ flexGrow: 0,
+ }));
// The usage panel stacks with the composer and any approval card, so it gets
// whatever room they leave below the header. Measured only while it is open
// so typing in the composer does not re-render the screen.
@@ -1718,12 +1728,19 @@ function ThreadDetailBody(
exiting={FadeOut.duration(140)}
>
{props.activePendingApproval ? (
- <PendingApprovalCard
- canOperateThread={props.canOperateThread}
- approval={props.activePendingApproval}
- respondingApprovalId={props.respondingApprovalId}
- onRespond={props.onRespondToApproval}
- />
+ <Animated.ScrollView
+ key={props.activePendingApproval.requestId}
+ style={approvalHeightStyle}
+ keyboardShouldPersistTaps="handled"
+ nestedScrollEnabled
+ >
+ <PendingApprovalCard
+ canOperateThread={props.canOperateThread}
+ approval={props.activePendingApproval}
+ respondingApprovalId={props.respondingApprovalId}
+ onRespond={props.onRespondToApproval}
+ />
+ </Animated.ScrollView>
) : null}
{props.activePendingUserInput ? (
<PendingUserInputCard