-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'andrew_testing' into fix/types-in-styles-quickfix-with-…
…regex
- Loading branch information
Showing
6 changed files
with
50 additions
and
80 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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,22 @@ | ||
import { Animated, Text } from 'react-native'; | ||
import { useSkeletonAnimation } from './useSkeletonAnimation'; | ||
|
||
export const RSkeleton = ({ style }) => { | ||
const fadeAnim = useSkeletonAnimation(); | ||
|
||
return ( | ||
<Animated.View | ||
style={{ | ||
opacity: fadeAnim, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: '#e2e1eb', | ||
width: '100%', | ||
borderRadius: '4px', | ||
...style, | ||
}} | ||
> | ||
<Text style={{ fontSize: '24px' }}> </Text> | ||
</Animated.View> | ||
); | ||
}; |
This file contains 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 |
---|---|---|
@@ -1,44 +1 @@ | ||
import { useState, useEffect } from 'react'; | ||
import { Animated, Text } from 'react-native'; | ||
|
||
const RSkeleton = ({style}) => { | ||
const [fadeAnim] = useState(new Animated.Value(1)); // Initial opacity set to 0 | ||
|
||
useEffect(() => { | ||
const startAnimation = () => { | ||
Animated.loop( | ||
Animated.sequence([ | ||
Animated.timing(fadeAnim, { | ||
toValue: 0, | ||
duration: 1000, | ||
useNativeDriver: false, // Add this if you encounter any issues with native driver | ||
}), | ||
Animated.timing(fadeAnim, { | ||
toValue: 1, | ||
duration: 1000, | ||
useNativeDriver: false, // Add this if you encounter any issues with native driver | ||
}), | ||
]), | ||
).start(); | ||
}; | ||
startAnimation(); | ||
}, [fadeAnim]); | ||
|
||
return ( | ||
<Animated.View | ||
style={{ | ||
opacity: fadeAnim, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: '#e2e1eb', | ||
width: "100%", | ||
borderRadius: "4px", | ||
...style | ||
}} | ||
> | ||
<Text style={{fontSize: "24px"}}>{' '}</Text> | ||
</Animated.View> | ||
); | ||
}; | ||
|
||
export default RSkeleton; | ||
export { RSkeleton } from './RSkeleton'; |
This file contains 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,25 @@ | ||
import { useEffect, useRef } from 'react'; | ||
import { Animated } from 'react-native'; | ||
|
||
export const useSkeletonAnimation = () => { | ||
const fadeAnim = useRef(new Animated.Value(1)); | ||
|
||
useEffect(() => { | ||
Animated.loop( | ||
Animated.sequence([ | ||
Animated.timing(fadeAnim.current, { | ||
toValue: 0, | ||
duration: 1000, | ||
useNativeDriver: false, // Add this if you encounter any issues with native driver | ||
}), | ||
Animated.timing(fadeAnim.current, { | ||
toValue: 1, | ||
duration: 1000, | ||
useNativeDriver: false, // Add this if you encounter any issues with native driver | ||
}), | ||
]), | ||
).start(); | ||
}, []); | ||
|
||
return fadeAnim.current; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains 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