Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .Jules/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
## [Unreleased]

### Added
- **Mobile Skeleton Loading:** Implemented skeleton loading for the HomeScreen group list.
- **Features:**
- Created reusable `Skeleton` component with pulsing animation.
- Replaced `ActivityIndicator` with `GroupListSkeleton` in `HomeScreen`.
- Improved perceived performance and reduced layout shift.
- **Technical:** Created `mobile/components/ui/Skeleton.js` and `mobile/components/skeletons/GroupListSkeleton.js`.

- **Password Strength Meter:** Added a visual password strength indicator to the signup form.
- **Features:**
- Real-time strength calculation (Length, Uppercase, Lowercase, Number, Symbol).
Expand Down
3 changes: 2 additions & 1 deletion .Jules/todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
- Impact: Native feel, users can easily refresh data
- Size: ~150 lines

- [ ] **[ux]** Complete skeleton loading for HomeScreen groups
- [x] **[ux]** Complete skeleton loading for HomeScreen groups
- Completed: 2026-02-09
- File: `mobile/screens/HomeScreen.js`
- Context: Replace ActivityIndicator with skeleton group cards
- Impact: Better loading experience, less jarring
Expand Down
47 changes: 47 additions & 0 deletions mobile/components/skeletons/GroupListSkeleton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { Card } from 'react-native-paper';
import Skeleton from '../ui/Skeleton';

const GroupListSkeleton = () => {
return (
<View
style={styles.container}
accessible={true}
accessibilityLabel="Loading groups"
accessibilityRole="progressbar"
>
{[...Array(5)].map((_, index) => (
<Card key={index} style={styles.card}>
<Card.Title
title={<Skeleton width={120} height={20} />}
left={(props) => (
<Skeleton
width={props.size}
height={props.size}
borderRadius={props.size / 2}
/>
)}
/>
<Card.Content>
<Skeleton width={200} height={16} style={styles.subtitle} />
</Card.Content>
</Card>
))}
Comment on lines +14 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick | 🔵 Trivial

Consider varying skeleton widths for a more natural look.

All five cards render identical skeleton dimensions (title: 120, subtitle: 200). Slightly randomizing or alternating widths (e.g., [120, 150, 100, 130, 110]) would produce a more realistic shimmer effect and avoid a rigid, repetitive appearance.

🤖 Prompt for AI Agents
In `@mobile/components/skeletons/GroupListSkeleton.js` around lines 14 - 30,
Update the static Skeleton dimensions in the GroupListSkeleton component so each
Card renders varied widths: define small arrays like titleWidths =
[120,150,100,130,110] and subtitleWidths = [200,160,180,140,170] and pick values
by index inside the map that renders Card and Skeleton (references: the map over
[...Array(5)], Card.Title, Card.Content, and Skeleton). Replace the hardcoded
numeric props (title: 120, subtitle: 200) with titleWidths[index] and
subtitleWidths[index] (or a simple deterministic alternation) so the skeletons
vary while keeping layout stable.

</View>
);
};

const styles = StyleSheet.create({
container: {
padding: 16,
},
card: {
marginBottom: 16,
},
subtitle: {
marginTop: 4,
},
});

export default GroupListSkeleton;
44 changes: 44 additions & 0 deletions mobile/components/ui/Skeleton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React, { useEffect, useRef } from 'react';
import { Animated } from 'react-native';
import { useTheme } from 'react-native-paper';

const Skeleton = ({ width, height, borderRadius = 4, style }) => {
const theme = useTheme();
const opacity = useRef(new Animated.Value(0.5)).current;

useEffect(() => {
Animated.loop(
Animated.sequence([
Animated.timing(opacity, {
toValue: 1,
duration: 1000,
useNativeDriver: true,
}),
Animated.timing(opacity, {
toValue: 0.5,
duration: 1000,
useNativeDriver: true,
}),
])
).start();
}, [opacity]);
Comment on lines +9 to +24
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Missing animation cleanup on unmount.

The looping animation is never stopped when the component unmounts, which can cause a memory leak and "update on unmounted component" warnings. Store the return value of Animated.loop(…).start() — or the loop reference — and call .stop() in the effect cleanup.

🛡️ Proposed fix
  useEffect(() => {
-   Animated.loop(
+   const animation = Animated.loop(
      Animated.sequence([
        Animated.timing(opacity, {
          toValue: 1,
          duration: 1000,
          useNativeDriver: true,
        }),
        Animated.timing(opacity, {
          toValue: 0.5,
          duration: 1000,
          useNativeDriver: true,
        }),
      ])
-   ).start();
+   );
+   animation.start();
+   return () => animation.stop();
  }, [opacity]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
Animated.loop(
Animated.sequence([
Animated.timing(opacity, {
toValue: 1,
duration: 1000,
useNativeDriver: true,
}),
Animated.timing(opacity, {
toValue: 0.5,
duration: 1000,
useNativeDriver: true,
}),
])
).start();
}, [opacity]);
useEffect(() => {
const animation = Animated.loop(
Animated.sequence([
Animated.timing(opacity, {
toValue: 1,
duration: 1000,
useNativeDriver: true,
}),
Animated.timing(opacity, {
toValue: 0.5,
duration: 1000,
useNativeDriver: true,
}),
])
);
animation.start();
return () => animation.stop();
}, [opacity]);
🤖 Prompt for AI Agents
In `@mobile/components/ui/Skeleton.js` around lines 9 - 24, The Animated.loop
started in the useEffect (which sequences Animated.timing on opacity) isn’t
stopped on unmount; capture the loop instance/animation returned by
Animated.loop(...) (or the value returned by .start()) and return a cleanup
function from useEffect that calls .stop() on that instance so the looping
animation is properly stopped when the component unmounts; reference the
useEffect, Animated.loop, opacity, .start(), and .stop() in your change.


return (
<Animated.View
style={[
{
width,
height,
borderRadius,
backgroundColor: theme.colors.surfaceVariant,
opacity,
},
style,
]}
accessibilityRole="progressbar"
accessibilityLabel="Loading..."
/>
);
};

export default Skeleton;
10 changes: 2 additions & 8 deletions mobile/screens/HomeScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import HapticButton from '../components/ui/HapticButton';
import HapticCard from '../components/ui/HapticCard';
import { HapticAppbarAction } from '../components/ui/HapticAppbar';
import GroupListSkeleton from '../components/skeletons/GroupListSkeleton';
import * as Haptics from "expo-haptics";
import { createGroup, getGroups, getOptimizedSettlements } from "../api/groups";
import { AuthContext } from "../context/AuthContext";
Expand Down Expand Up @@ -257,9 +258,7 @@ const HomeScreen = ({ navigation }) => {
</Appbar.Header>

{isLoading ? (
<View style={styles.loaderContainer}>
<ActivityIndicator size="large" />
</View>
<GroupListSkeleton />
) : (
<FlatList
data={groups}
Expand Down Expand Up @@ -289,11 +288,6 @@ const styles = StyleSheet.create({
container: {
flex: 1,
},
loaderContainer: {
flex: 1,
justifyContent: "center",
alignItems: "center",
},
list: {
padding: 16,
},
Expand Down
Loading