Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions apps/mobile/src/features/threads/ThreadDetailScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ import Animated, {
ReduceMotion,
useAnimatedReaction,
useAnimatedStyle,
useDerivedValue,
useSharedValue,
withTiming,
} from "react-native-reanimated";
Expand Down Expand Up @@ -623,6 +624,13 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
},
[userInputCoverageApplies],
);
// The floating control is anchored to the bar's top edge, so ride it up
// with the expanded card instead of drawing it over the questions.
const floatingControlLift = useDerivedValue(
() =>
userInputCoverageApplies ? userInputCardProgress.value * userInputCardCoverage.value : 0,
[userInputCoverageApplies],
);
const { freeze, scrollMessageToEnd } = useKeyboardScrollToEnd({ listRef });
const endFollowEnabledRef = useRef(true);
endFollowEnabledRef.current = endFollowEnabled;
Expand Down Expand Up @@ -1070,6 +1078,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread
<FloatingWorkingControl
colorScheme={isDarkMode ? "dark" : "light"}
status={floatingStatus}
lift={floatingControlLift}
devicePreview={
devicePreviews.length > 0
? { count: devicePreviews.length, onPress: openDevicePreview }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Animated, {
FadeIn,
FadeOut,
ReduceMotion,
type SharedValue,
useAnimatedStyle,
useSharedValue,
withTiming,
Expand Down Expand Up @@ -72,6 +73,8 @@ export function FloatingWorkingControl(props: {
readonly onOpenAgents: () => void;
readonly queuedCount: number;
readonly onOpenQueue: () => void;
/** Extra distance to rise above the anchor, e.g. an overlay card's coverage. */
readonly lift?: SharedValue<number>;
}) {
const { width: windowWidth } = useWindowDimensions();
const [overlayWidth, setOverlayWidth] = useState(windowWidth);
Expand Down Expand Up @@ -99,6 +102,10 @@ export function FloatingWorkingControl(props: {
separationProgress.value = withTiming(props.showScrollToEnd ? 1 : 0, CONTROL_TIMING);
}, [props.showScrollToEnd, separationProgress]);

const lift = props.lift;
const liftStyle = useAnimatedStyle(() => ({
transform: [{ translateY: -(lift?.value ?? 0) }],
}));
const arrowTransformStyle = useAnimatedStyle(() => ({
transform: [{ translateX: -CONTROL_SEPARATION * (1 - separationProgress.value) }],
}));
Expand Down Expand Up @@ -231,7 +238,7 @@ export function FloatingWorkingControl(props: {
<Animated.View
pointerEvents="box-none"
className="absolute left-0 right-0 z-20 items-center"
style={{ top: -CONTROL_OVERLAY_OFFSET }}
style={[{ top: -CONTROL_OVERLAY_OFFSET }, liftStyle]}
onLayout={(event) => setOverlayWidth(event.nativeEvent.layout.width)}
entering={NATIVE_LIQUID_GLASS_SUPPORTED ? undefined : CONTROL_ENTERING}
exiting={NATIVE_LIQUID_GLASS_SUPPORTED ? undefined : CONTROL_EXITING}
Expand Down
Loading