Skip to content

Commit 81ab3e8

Browse files
committed
CommentsScreen: convert close-thread bar to Expo UI Button
1 parent 3b198ba commit 81ab3e8

1 file changed

Lines changed: 51 additions & 62 deletions

File tree

screens/CommentsScreen.jsx

Lines changed: 51 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import {
1111
LayoutAnimation,
1212
Pressable,
1313
ScrollView,
14-
StyleSheet,
1514
View,
1615
useWindowDimensions,
1716
} from 'react-native';
@@ -26,17 +25,34 @@ import {
2625
useLocalSearchParams,
2726
useNavigation,
2827
} from 'expo-router';
29-
import { FlatList, TouchableOpacity } from 'react-native-gesture-handler';
28+
import { FlatList } from 'react-native-gesture-handler';
3029
import { useSafeAreaInsets } from 'react-native-safe-area-context';
3130

31+
import {
32+
Host,
33+
Button,
34+
HStack,
35+
Image as SwiftUIImage,
36+
Text as SwiftUIText,
37+
ZStack,
38+
} from '@expo/ui/swift-ui';
39+
import {
40+
background,
41+
buttonStyle,
42+
controlSize,
43+
font,
44+
foregroundStyle,
45+
frame,
46+
shapes,
47+
tint,
48+
} from '@expo/ui/swift-ui/modifiers';
49+
3250
import useStore from '../hooks/useStore';
3351
import useTheme from '../hooks/useTheme';
3452
import useViewport from '../hooks/useViewport';
3553

3654
import * as Haptics from 'expo-haptics';
37-
import { GlassView } from 'expo-glass-effect';
3855
import { LinearGradient } from 'expo-linear-gradient';
39-
import { SymbolView } from 'expo-symbols';
4056

4157
import CommentContainer from '../components/CommentContainer';
4258
import CommentPage from '../components/CommentPage';
@@ -354,82 +370,55 @@ export default function CommentsScreen({ isPreview: isPreviewProp }) {
354370
shadowColor: isDark ? colors.primary : undefined,
355371
}}
356372
>
357-
<GlassView
358-
style={{
359-
borderRadius: 30,
360-
borderCurve: 'continuous',
361-
borderWidth: StyleSheet.hairlineWidth,
362-
borderColor: colors.opaqueSeparator,
363-
overflow: 'hidden',
364-
}}
365-
onLayout={({ nativeEvent }) => {
366-
console.log('📐 GlassView onLayout', nativeEvent.layout);
373+
<Host
374+
matchContents
375+
onLayoutContent={({ nativeEvent }) => {
367376
footerRef.current?.setNativeProps({
368377
style: {
369-
height: nativeEvent.layout.height + 30,
378+
height: nativeEvent.height + 30,
370379
},
371380
});
372381
}}
373382
>
374-
<TouchableOpacity
375-
disallowInterruption
383+
<Button
376384
onPress={() => {
377385
router.back();
378386
}}
379-
style={{
380-
paddingVertical: 14,
381-
paddingHorizontal: 14,
382-
alignItems: 'center',
383-
}}
384-
hitSlop={{
385-
top: 44,
386-
right: 44,
387-
bottom: 44,
388-
left: 44,
389-
}}
387+
modifiers={[
388+
buttonStyle('glass'),
389+
controlSize('large'),
390+
tint(colors.primary),
391+
]}
390392
>
391-
<View
392-
style={{
393-
flexDirection: 'row',
394-
alignItems: 'center',
395-
}}
396-
>
397-
<SymbolView
398-
name="xmark.circle"
393+
<HStack spacing={8} alignment="center">
394+
<SwiftUIImage
395+
systemName="xmark.circle"
399396
size={22}
400-
weight="medium"
401-
style={{ marginRight: 8 }}
397+
modifiers={[font({ weight: 'medium' })]}
402398
/>
403-
<Text type="link" bold>
399+
<SwiftUIText modifiers={[font({ weight: 'medium' })]}>
404400
Close thread
405-
</Text>
401+
</SwiftUIText>
406402
{(parseInt(zIndex) > 1 || showZIndex === 'true') && (
407-
<View
408-
style={{
409-
borderRadius: 100,
410-
backgroundColor: colors.opaqueSeparator,
411-
width: 24,
412-
height: 24,
413-
marginLeft: 8,
414-
overflow: 'hidden',
415-
}}
403+
<ZStack
404+
modifiers={[
405+
frame({ width: 24, height: 24 }),
406+
background(colors.opaqueSeparator, shapes.circle()),
407+
]}
416408
>
417-
<Text
418-
bold
419-
center
420-
style={{
421-
color: colors.secondaryText,
422-
lineHeight: 24,
423-
fontSize: 14,
424-
}}
409+
<SwiftUIText
410+
modifiers={[
411+
font({ size: 14, weight: 'bold' }),
412+
foregroundStyle(colors.secondaryText),
413+
]}
425414
>
426415
{parseInt(zIndex)}
427-
</Text>
428-
</View>
416+
</SwiftUIText>
417+
</ZStack>
429418
)}
430-
</View>
431-
</TouchableOpacity>
432-
</GlassView>
419+
</HStack>
420+
</Button>
421+
</Host>
433422
</Animated.View>
434423
)}
435424
</Container>

0 commit comments

Comments
 (0)