-
Notifications
You must be signed in to change notification settings - Fork 23
[Mobile] Add skeleton loading to HomeScreen #294
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
Open
Devasy
wants to merge
1
commit into
main
Choose a base branch
from
jules-ux-mobile-skeleton-16733077764637405702
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import React from 'react'; | ||
| import { View, StyleSheet, FlatList } from 'react-native'; | ||
| import { Card } from 'react-native-paper'; | ||
| import Skeleton from '../ui/Skeleton'; | ||
|
|
||
| const GroupListSkeleton = () => { | ||
| const dummyData = [1, 2, 3, 4, 5]; // Render 5 skeleton items | ||
|
|
||
| const renderItem = () => ( | ||
| <Card style={styles.card} mode="elevated"> | ||
| <Card.Title | ||
| title={<Skeleton width={150} height={20} style={styles.skeletonTitle} />} | ||
| subtitle={<Skeleton width={100} height={16} style={styles.skeletonSubtitle} />} | ||
| left={(props) => ( | ||
| <Skeleton | ||
| width={props.size} | ||
| height={props.size} | ||
| borderRadius={props.size / 2} | ||
| style={styles.skeletonAvatar} | ||
| /> | ||
| )} | ||
| /> | ||
| <Card.Content> | ||
| <Skeleton width={120} height={16} style={styles.skeletonStatus} /> | ||
| </Card.Content> | ||
| </Card> | ||
| ); | ||
|
|
||
| return ( | ||
| <View style={styles.container} accessible={true} accessibilityLabel="Loading groups"> | ||
| <FlatList | ||
| data={dummyData} | ||
| renderItem={renderItem} | ||
| keyExtractor={(item) => item.toString()} | ||
| contentContainerStyle={styles.list} | ||
| scrollEnabled={false} // Disable scrolling for skeleton state | ||
| /> | ||
| </View> | ||
| ); | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| container: { | ||
| flex: 1, | ||
| }, | ||
| list: { | ||
| padding: 16, | ||
| }, | ||
| card: { | ||
| marginBottom: 16, | ||
| }, | ||
| skeletonTitle: { | ||
| marginTop: 4, | ||
| marginBottom: 4, | ||
| }, | ||
| skeletonSubtitle: { | ||
| marginTop: 4, | ||
| }, | ||
| skeletonAvatar: { | ||
| marginRight: 8, | ||
| }, | ||
| skeletonStatus: { | ||
| marginTop: 8, | ||
| } | ||
| }); | ||
|
|
||
| export default GroupListSkeleton; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import React, { useEffect, useRef } from 'react'; | ||
| import { Animated, StyleSheet } from 'react-native'; | ||
| import { Surface, useTheme } from 'react-native-paper'; | ||
|
|
||
| const Skeleton = ({ width, height, borderRadius = 4, style }) => { | ||
| const theme = useTheme(); | ||
| const opacity = useRef(new Animated.Value(0.3)).current; | ||
|
|
||
| useEffect(() => { | ||
| const animation = Animated.loop( | ||
| Animated.sequence([ | ||
| Animated.timing(opacity, { | ||
| toValue: 1, | ||
| duration: 1000, | ||
| useNativeDriver: true, | ||
| }), | ||
| Animated.timing(opacity, { | ||
| toValue: 0.3, | ||
| duration: 1000, | ||
| useNativeDriver: true, | ||
| }), | ||
| ]) | ||
| ); | ||
| animation.start(); | ||
|
|
||
| return () => animation.stop(); | ||
| }, [opacity]); | ||
|
|
||
| return ( | ||
| <Animated.View | ||
| style={[ | ||
| { opacity }, | ||
| style, | ||
| ]} | ||
| accessibilityRole="progressbar" | ||
| accessibilityLabel="Loading..." | ||
| > | ||
| <Surface | ||
| style={[ | ||
| styles.skeleton, | ||
| { | ||
| width, | ||
| height, | ||
| borderRadius, | ||
| backgroundColor: theme.colors.surfaceVariant, | ||
| }, | ||
| ]} | ||
| elevation={0} | ||
| /> | ||
| </Animated.View> | ||
| ); | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| skeleton: { | ||
| overflow: 'hidden', | ||
| }, | ||
| }); | ||
|
|
||
| export default Skeleton; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: Devasy/splitwiser
Length of output: 1817
🏁 Script executed:
Repository: Devasy/splitwiser
Length of output: 2201
Do not announce each skeleton block as a progressbar.
Every Skeleton instance exposes itself as a separate progressbar with "Loading..." label via lines 35–36. In
GroupListSkeleton.js, therenderItem()function creates 4 Skeleton instances per card (title, subtitle, avatar, status), which renders 5 times in a FlatList—resulting in 20 total progressbar announcements. This creates repetitive noise for screen-reader users and poor focus navigation, even though the container already has a high-level "Loading groups" announcement (line 30 of GroupListSkeleton).Make this primitive decorative by default with accessibility opt-in only when needed.
Proposed fix
🤖 Prompt for AI Agents