Skip to content

Commit

Permalink
Merge branch 'andrew_testing' into fix/types-in-styles-quickfix-with-…
Browse files Browse the repository at this point in the history
…regex
  • Loading branch information
andrew-bierman authored Jan 11, 2024
2 parents d6af0a7 + 42517e6 commit 812a792
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 80 deletions.
5 changes: 0 additions & 5 deletions client/components/skeleton/index.tsx

This file was deleted.

22 changes: 22 additions & 0 deletions packages/ui/src/RSkeleton/RSkeleton.tsx
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>
);
};
45 changes: 1 addition & 44 deletions packages/ui/src/RSkeleton/index.tsx
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';
25 changes: 25 additions & 0 deletions packages/ui/src/RSkeleton/useSkeletonAnimation.ts
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;
};
28 changes: 0 additions & 28 deletions packages/ui/src/Skeleton/index.tsx

This file was deleted.

5 changes: 2 additions & 3 deletions packages/ui/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import RParagraph from './Rparagraph';
import RInput from './RInput';
import RImage from './RImage';
import RScrollView from './RScrollview';
import RSkeleton from './RSkeleton';
import RSwitch from './RSwitch';
import RIconButton from './RIconButton';
import RSeparator from './RSeparator';
Expand All @@ -27,6 +26,8 @@ import XStack from './XStack';
import YStack from './YStack';
import RButton from './RButton';

export { RSkeleton } from './RSkeleton';

export {
RH1,
RH2,
Expand All @@ -52,7 +53,6 @@ export {
RIconButton,
RImage,
RScrollView,
RSkeleton,
XStack,
YStack,
RButton,
Expand All @@ -71,7 +71,6 @@ export * from './Rparagraph';
export * from './RInput';
export * from './RImage';
export * from './RScrollview';
export * from './Skeleton';
export * from './XStack';
export * from './YStack';

Expand Down

0 comments on commit 812a792

Please sign in to comment.