Skip to content

Commit 9a8b3f7

Browse files
committed
merge: sync main into local image refresh
2 parents fb41ce3 + 3368dd7 commit 9a8b3f7

55 files changed

Lines changed: 1866 additions & 331 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,18 @@ jobs:
272272
env:
273273
TEST_PACKAGES: ${{ needs.changes.outputs.test_packages }}
274274
run: |
275+
set -o pipefail
275276
filters=(--filter '!t3' --filter '!@t3tools/monorepo' --filter '!@t3tools/web')
276277
if [[ -n "$TEST_PACKAGES" ]]; then
277278
filters=()
278279
for package in $TEST_PACKAGES; do filters+=(--filter "$package"); done
279280
fi
280-
vp run --parallel --concurrency-limit 4 "${filters[@]}" test
281+
# The runner's trace writer can crash on surrogate pairs in test output.
282+
vp run --parallel --concurrency-limit 4 "${filters[@]}" test 2>&1 | python3 -u -c '
283+
import sys
284+
for line in sys.stdin:
285+
sys.stdout.write(line.encode("ascii", "backslashreplace").decode("ascii"))
286+
'
281287
282288
# The web suite is the largest outside the server. In the shared Test job it
283289
# started last and ran alone for about 40s after everything else finished.

‎apps/mobile/src/Stack.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,9 +1042,15 @@ export const RootStack = RootStackConfig.with(function AdaptiveRootStack({ Navig
10421042
return (
10431043
<Navigator
10441044
screenLayout={(props) => <GuardedScreenLayout {...props} />}
1045-
screenOptions={({ route }) =>
1045+
screenOptions={({ route, navigation }) =>
10461046
Platform.OS === "android"
1047-
? { animation: androidWorkspaceDestinationAnimation(route.name, usesSplitView) }
1047+
? {
1048+
animation: androidWorkspaceDestinationAnimation(
1049+
route,
1050+
navigation.getState().routes,
1051+
usesSplitView,
1052+
),
1053+
}
10481054
: {}
10491055
}
10501056
/>

‎apps/mobile/src/components/ui/SegmentedControl.shared.tsx‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import { useState } from "react";
22
import { I18nManager, Platform, Pressable, View } from "react-native";
3-
import Animated, { useAnimatedStyle, useReducedMotion, withTiming } from "react-native-reanimated";
3+
import Animated, {
4+
useAnimatedStyle,
5+
useDerivedValue,
6+
useReducedMotion,
7+
withTiming,
8+
} from "react-native-reanimated";
49

510
import { segmentedControlColors } from "./segmentedControlColors";
611
import { AppText } from "./AppText";
@@ -18,10 +23,14 @@ export function SegmentedControl<Value extends string | number>(
1823
const reduceMotion = useReducedMotion();
1924
const selectedIndex = props.options.findIndex((option) => option.value === props.selected);
2025
const segmentWidth = props.options.length ? Math.max(0, width - 6) / props.options.length : 0;
21-
const selectionOffset = selectedIndex * segmentWidth * (I18nManager.isRTL ? -1 : 1);
26+
const direction = I18nManager.isRTL ? -1 : 1;
27+
// The index animates, not the offset, so a resize moves the selection without sliding it.
28+
const selectedPosition = useDerivedValue(() =>
29+
withTiming(selectedIndex, { duration: reduceMotion ? 0 : 160 }),
30+
);
2231
const selectionStyle = useAnimatedStyle(() => ({
2332
width: segmentWidth,
24-
transform: [{ translateX: withTiming(selectionOffset, { duration: reduceMotion ? 0 : 160 }) }],
33+
transform: [{ translateX: selectedPosition.value * segmentWidth * direction }],
2534
}));
2635
const { trackColor, selectedColor, selectedTextColor, mutedColor } = segmentedControlColors(
2736
colors,
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { useSyncExternalStore } from "react";
2+
import { KeyboardController, KeyboardEvents } from "react-native-keyboard-controller";
3+
4+
// `useKeyboardState` only flips on willShow and didHide. This follows the will-events, so a
5+
// layout that makes room for the keyboard gives it back as soon as the keyboard starts hiding.
6+
let keyboardShowing = KeyboardController.isVisible();
7+
function subscribeKeyboardShowing(onChange: () => void) {
8+
keyboardShowing = KeyboardController.isVisible();
9+
const willShow = KeyboardEvents.addListener("keyboardWillShow", () => {
10+
keyboardShowing = true;
11+
onChange();
12+
});
13+
const willHide = KeyboardEvents.addListener("keyboardWillHide", () => {
14+
keyboardShowing = false;
15+
onChange();
16+
});
17+
return () => {
18+
willShow.remove();
19+
willHide.remove();
20+
};
21+
}
22+
const getKeyboardShowing = () => keyboardShowing;
23+
24+
export function useSoftKeyboardShowing() {
25+
return useSyncExternalStore(subscribeKeyboardShowing, getKeyboardShowing);
26+
}

0 commit comments

Comments
 (0)