-
Notifications
You must be signed in to change notification settings - Fork 27
[jules] ux: Complete skeleton loading for HomeScreen groups #316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import React from 'react'; | ||
| import { View, StyleSheet, ScrollView } from 'react-native'; | ||
| import { Card } from 'react-native-paper'; | ||
| import Skeleton from '../ui/Skeleton'; | ||
|
|
||
| const GroupListSkeleton = () => { | ||
| // Array of 5 items to show while loading | ||
| const skeletonItems = Array.from({ length: 5 }, (_, i) => i); | ||
|
|
||
| return ( | ||
| <View | ||
| style={styles.container} | ||
| accessible={true} | ||
| accessibilityRole="progressbar" | ||
| accessibilityLabel="Loading groups" | ||
| > | ||
| <ScrollView contentContainerStyle={styles.list}> | ||
| {skeletonItems.map((item) => ( | ||
| <Card key={item} style={styles.card}> | ||
| <Card.Title | ||
| title={<Skeleton width={120} height={20} />} | ||
| left={(props) => ( | ||
| <View {...props}> | ||
| <Skeleton width={40} height={40} borderRadius={20} /> | ||
| </View> | ||
| )} | ||
| /> | ||
| <Card.Content> | ||
| <Skeleton width={150} height={16} style={styles.statusSkeleton} /> | ||
| </Card.Content> | ||
| </Card> | ||
| ))} | ||
| </ScrollView> | ||
| </View> | ||
| ); | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| container: { | ||
| flex: 1, | ||
| }, | ||
| list: { | ||
| padding: 16, | ||
| }, | ||
| card: { | ||
| marginBottom: 16, | ||
| }, | ||
| statusSkeleton: { | ||
| marginTop: 4, | ||
| }, | ||
| }); | ||
|
|
||
| export default GroupListSkeleton; | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,61 @@ | ||||||
| import React, { useEffect } from 'react'; | ||||||
| import { View, StyleSheet } from 'react-native'; | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Remove unused
🧹 Proposed cleanup-import { View, StyleSheet } from 'react-native';
+import { StyleSheet } from 'react-native';📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| import Animated, { | ||||||
| useSharedValue, | ||||||
| useAnimatedStyle, | ||||||
| withRepeat, | ||||||
| withTiming, | ||||||
| withSequence, | ||||||
| cancelAnimation, | ||||||
| } from 'react-native-reanimated'; | ||||||
| import { useTheme } from 'react-native-paper'; | ||||||
|
|
||||||
| const Skeleton = ({ width, height, borderRadius = 4, style }) => { | ||||||
| const theme = useTheme(); | ||||||
| const opacity = useSharedValue(0.3); | ||||||
|
|
||||||
| useEffect(() => { | ||||||
| opacity.value = withRepeat( | ||||||
| withSequence( | ||||||
| withTiming(0.7, { duration: 1000 }), | ||||||
| withTiming(0.3, { duration: 1000 }) | ||||||
| ), | ||||||
| -1, | ||||||
| true | ||||||
| ); | ||||||
|
|
||||||
| return () => { | ||||||
| cancelAnimation(opacity); | ||||||
| }; | ||||||
| }, []); | ||||||
|
|
||||||
| const animatedStyle = useAnimatedStyle(() => { | ||||||
| return { | ||||||
| opacity: opacity.value, | ||||||
| }; | ||||||
| }); | ||||||
|
|
||||||
| return ( | ||||||
| <Animated.View | ||||||
| style={[ | ||||||
| styles.skeleton, | ||||||
| { | ||||||
| width, | ||||||
| height, | ||||||
| borderRadius, | ||||||
| backgroundColor: theme.colors.surfaceVariant, | ||||||
| }, | ||||||
| animatedStyle, | ||||||
| style, | ||||||
| ]} | ||||||
| /> | ||||||
| ); | ||||||
| }; | ||||||
|
|
||||||
| const styles = StyleSheet.create({ | ||||||
| skeleton: { | ||||||
| overflow: 'hidden', | ||||||
| }, | ||||||
| }); | ||||||
|
|
||||||
| export default Skeleton; | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Skeleton layout may not match the actual card structure.
Looking at
HomeScreen.js(lines 194-207 in context), the actual group cards useHapticCard.Titlewith asubtitleprop for the settlement status, not a separateCard.Contentblock. The skeleton here usesCard.Contentwhich may cause a slight layout shift when data loads.Consider using the
subtitleprop onCard.Titleto better match the actual layout:♻️ Proposed fix to match actual card layout
<Card key={item} style={styles.card}> <Card.Title title={<Skeleton width={120} height={20} />} + subtitle={<Skeleton width={150} height={16} style={styles.statusSkeleton} />} left={(props) => ( <View {...props}> <Skeleton width={40} height={40} borderRadius={20} /> </View> )} /> - <Card.Content> - <Skeleton width={150} height={16} style={styles.statusSkeleton} /> - </Card.Content> </Card>🤖 Prompt for AI Agents