-
Notifications
You must be signed in to change notification settings - Fork 23
Fix/multiple UI issues #131
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
Changes from 8 commits
f19dff5
e0d3db9
ccf234a
38f65ba
6d75613
19ca52a
d5600b3
adc0e0a
6df2118
97b7538
bad9a45
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,40 @@ | ||
| import React, { useEffect } from "react"; | ||
| import { View, StyleSheet } from "react-native"; | ||
| import Animated, { | ||
| useSharedValue, | ||
| useAnimatedStyle, | ||
| withRepeat, | ||
| withTiming, | ||
| interpolateColor, | ||
| } from "react-native-reanimated"; | ||
| import { colors } from "../styles/theme"; | ||
|
|
||
| const SkeletonLoader = ({ style }) => { | ||
| const progress = useSharedValue(0); | ||
|
|
||
| useEffect(() => { | ||
| progress.value = withRepeat(withTiming(1, { duration: 1000 }), -1, true); | ||
| }, []); | ||
|
|
||
| const animatedStyle = useAnimatedStyle(() => { | ||
| const backgroundColor = interpolateColor( | ||
| progress.value, | ||
| [0, 1], | ||
| [colors.secondary, colors.white] | ||
| ); | ||
| return { | ||
| backgroundColor, | ||
| }; | ||
| }); | ||
|
|
||
| return <Animated.View style={[styles.skeleton, animatedStyle, style]} />; | ||
| }; | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| skeleton: { | ||
| backgroundColor: colors.secondary, | ||
| borderRadius: 4, | ||
| }, | ||
| }); | ||
|
|
||
| export default SkeletonLoader; | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,8 @@ | |
| "react-native-paper": "^5.14.5", | ||
| "react-native-safe-area-context": "^5.5.2", | ||
| "react-native-screens": "^4.13.1", | ||
| "react-native-web": "^0.20.0" | ||
| "react-native-web": "^0.20.0", | ||
| "react-native-reanimated": "~3.17.4" | ||
| }, | ||
|
Comment on lines
+27
to
29
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. 💡 Verification agent 🧩 Analysis chainEnsure Reanimated is fully configured (Babel plugin + install checks) Adding react-native-reanimated requires the Babel plugin and correct plugin ordering to avoid runtime errors and to enable worklets. Verify the project’s babel.config.js includes the plugin last, and that web support is considered if you target web. Run this script to confirm the plugin is present and last in the plugins array: If missing, add this to babel.config.js (ensure it’s the last plugin): module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
// other plugins...
"react-native-reanimated/plugin", // must be last
],
};
};🏁 Script executed: #!/bin/bash
set -euo pipefail
# Locate babel config(s)
fd -a '^babel\.config\.js$' | while read -r f; do
echo "Checking $f"
# Show plugins line(s)
rg -n "plugins" -A 5 -n "$f"
# Check if reanimated plugin is present
if rg -q "react-native-reanimated/plugin" "$f"; then
echo "✓ Found reanimated plugin in $f"
else
echo "✗ Missing reanimated plugin in $f"
fi
doneLength of output: 61 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "1) Locate babel config files (common names):"
find . -maxdepth 4 -type f \( -iname "babel.config.js" -o -iname "babel.config.cjs" -o -iname "babel.config.mjs" -o -iname ".babelrc" -o -iname ".babelrc.js" -o -iname ".babelrc.json" \) -print || true
echo
echo "2) Check package.json for a 'babel' field:"
if [ -f package.json ]; then
rg -n '"babel"\s*:' package.json || echo "No 'babel' key in package.json"
else
echo "No package.json at repository root"
fi
echo
echo "3) Search entire repo for reanimated plugin string:"
rg -n --hidden --no-ignore 'react-native-reanimated/plugin' --glob '!node_modules' || echo "No occurrences of reanimated plugin string found"
echo
echo "4) Search for any mention of react-native-reanimated:"
rg -n --hidden --no-ignore 'react-native-reanimated' --glob '!node_modules' || echo "No occurrences of react-native-reanimated found"
echo
echo "5) If any babel config files found above, print their contents (best-effort):"
for f in $(find . -maxdepth 4 -type f \( -iname "babel.config.js" -o -iname "babel.config.cjs" -o -iname ".babelrc" -o -iname ".babelrc.js" -o -iname ".babelrc.json" \) -print); do
echo "---- $f ----"
sed -n '1,240p' "$f"
echo
doneLength of output: 1918 Add react-native-reanimated Babel plugin (must be last) and verify setup react-native-reanimated is present (frontend/package.json) and imported (frontend/components/SkeletonLoader.js), but no Babel config (.babelrc / babel.config.*) was found — the Reanimated Babel plugin appears to be missing. Files to fix / check:
Suggested babel config (ensure the plugin is the last entry in plugins): // frontend/babel.config.js
module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"], // or your project's presets
plugins: [
// other plugins...
"react-native-reanimated/plugin" // MUST be last
],
};
};After adding the plugin: clear Metro cache / rebuild the app and verify worklets/runtime errors are gone. If you target web, also verify Reanimated's web setup for your project. 🤖 Prompt for AI Agents |
||
| "devDependencies": { | ||
| "@babel/core": "^7.20.0" | ||
|
|
||
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.
🛠️ Refactor suggestion
Add animation cleanup and satisfy hooks deps
Cleanup prevents lingering animations after unmount and fixes the missing dependency warning.
Apply:
import Animated, { useSharedValue, useAnimatedStyle, withRepeat, withTiming, interpolateColor, + cancelAnimation, } from "react-native-reanimated"; @@ - useEffect(() => { - progress.value = withRepeat(withTiming(1, { duration: 1000 }), -1, true); - }, []); + useEffect(() => { + progress.value = withRepeat(withTiming(1, { duration: 1000 }), -1, true); + return () => cancelAnimation(progress); + }, [progress]);Also applies to: 15-18
🤖 Prompt for AI Agents