-
Notifications
You must be signed in to change notification settings - Fork 23
[jules] ux: Complete skeleton loading for HomeScreen groups #271
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,87 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import React, { useEffect, useRef } from "react"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { View, StyleSheet, Animated } from "react-native"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Card, useTheme } from "react-native-paper"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const SkeletonGroupCard = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const theme = useTheme(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const opacity = useRef(new Animated.Value(0.3)).current; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Animated.loop( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Animated.sequence([ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Animated.timing(opacity, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| toValue: 0.7, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| duration: 800, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useNativeDriver: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Animated.timing(opacity, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| toValue: 0.3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| duration: 800, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| useNativeDriver: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).start(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, []); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+24
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. 🧩 Analysis chain🏁 Script executed: fd "SkeletonGroupCard.js" --type fRepository: Devasy/splitwiser Length of output: 99 🏁 Script executed: cat -n mobile/components/SkeletonGroupCard.jsRepository: Devasy/splitwiser Length of output: 2752 🌐 Web query:
💡 Result: To avoid “leaks” (and React warnings) with Why this matters
Recommended cleanup pattern (hooks)import { useEffect, useRef } from 'react';
import { Animated, Easing } from 'react-native';
export function useLoopingSpin() {
const value = useRef(new Animated.Value(0)).current;
const loopRef = useRef<Animated.CompositeAnimation | null>(null);
useEffect(() => {
const anim = Animated.loop(
Animated.timing(value, {
toValue: 1,
duration: 1000,
easing: Easing.linear,
useNativeDriver: true,
isInteraction: false, // helps avoid blocking VirtualizedList rendering while running [1]
})
);
loopRef.current = anim;
anim.start(); // avoid passing a completion callback unless you truly need it [2]
return () => {
loopRef.current?.stop(); // stop the loop explicitly
loopRef.current = null;
value.stopAnimation(); // extra safety: stop any driver/tracking on the value
value.setValue(0); // optional: reset for next mount
};
}, [value]);
return value;
}Also clean up listeners (common real leak source)If you used Sources: React Native Stop the animation loop on unmount to prevent memory leaks. The 🧩 Proposed fix useEffect(() => {
- Animated.loop(
+ const animation = Animated.loop(
Animated.sequence([
Animated.timing(opacity, {
toValue: 0.7,
duration: 800,
useNativeDriver: true,
}),
Animated.timing(opacity, {
toValue: 0.3,
duration: 800,
useNativeDriver: true,
}),
])
- ).start();
+ );
+ animation.start();
+ return () => animation.stop();
}, []);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const styles = StyleSheet.create({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| card: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| marginBottom: 16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backgroundColor: theme.colors.surface, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| row: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| flexDirection: "row", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alignItems: "center", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| padding: 16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| avatarPlaceholder: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width: 40, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 40, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| borderRadius: 20, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backgroundColor: theme.colors.surfaceVariant, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| marginRight: 16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| textContainer: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| flex: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| justifyContent: "center", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| titlePlaceholder: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 20, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width: "60%", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backgroundColor: theme.colors.surfaceVariant, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| borderRadius: 4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cardContent: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paddingHorizontal: 16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| paddingBottom: 16, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| statusPlaceholder: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| height: 14, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| width: "40%", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| backgroundColor: theme.colors.surfaceVariant, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| borderRadius: 4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Card | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| style={styles.card} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| accessible={true} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| accessibilityRole="progressbar" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| accessibilityLabel="Loading group" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Animated.View style={{ opacity }}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <View style={styles.row}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <View style={styles.avatarPlaceholder} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <View style={styles.textContainer}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <View style={styles.titlePlaceholder} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </View> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </View> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <View style={styles.cardContent}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <View style={styles.statusPlaceholder} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </View> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Animated.View> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Card> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default SkeletonGroupCard; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
Fix the completion date (currently in the future).
“Completed: 2026-02-04” is after the PR creation date (2026-02-02) and today (2026-02-02), which makes the log inaccurate. Please set it to the actual completion date or remove it until completion.
🛠️ Possible fix
📝 Committable suggestion
🤖 Prompt for AI Agents