Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(mobile): Android taps and tab switches no longer stall with several environments #45789

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 16 commits intomain fromrefs/pull/45789/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

Showing 46 changed files with 33 additions and 35 deletions (loading 42).

x
0 of 46 viewed, 46 left
17 additions and 20 deletionsapps/mobile/src/components/ui/RadioIndicator.android.tsxModified
View file
@@ -1,28 +1,25 @@
-import { RadioButton } from "@expo/ui/jetpack-compose";
-import { size } from "@expo/ui/jetpack-compose/modifiers";
import { View } from "react-native";
-import { NativeThemeHost } from "./NativeThemeHost.android";
-import { useControlTheme } from "./useControlTheme";
​
+import { cn } from "../../lib/cn";
+​
+// Material's radio, drawn with views: a Compose RadioButton needs a Compose host per row, and
+// mounting hundreds of those made long pickers stutter while scrolling.
/** The enclosing radio row owns selection, touch and accessibility. */
export function RadioIndicator({ selected }: { readonly selected: boolean }) {
- const { colors, systemColorsActive } = useControlTheme();
return (
- <View pointerEvents="none" importantForAccessibility="no-hide-descendants">
- <NativeThemeHost ignoreSafeAreaKeyboardInsets style={{ width: 24, height: 24 }}>
- <RadioButton
- selected={selected}
- modifiers={[size(24, 24)]}
- colors={
- systemColorsActive
- ? {}
- : {
- selectedColor: colors["--color-primary-text"],
- unselectedColor: colors["--color-foreground-muted"],
- }
- }
- />
- </NativeThemeHost>
+ <View