-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cf72a6a
commit 77d289f
Showing
14 changed files
with
14,383 additions
and
7,001 deletions.
There are no files selected for viewing
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,51 @@ | ||
import { View, Text, ViewStyle, StatusBar } from "react-native"; | ||
import React from "react"; | ||
import { useDrawerProgress } from "@react-navigation/drawer"; | ||
import Animated, { | ||
Extrapolate, | ||
interpolate, | ||
useAnimatedStyle, | ||
useDerivedValue, | ||
} from "react-native-reanimated"; | ||
import { StyleSheet } from "react-native"; | ||
|
||
interface ScaledViewProps { | ||
children: React.ReactNode; | ||
style?: ViewStyle; | ||
} | ||
|
||
const ScaledView = ({ children, style }: ScaledViewProps) => { | ||
const progress = useDrawerProgress(); | ||
const scale = useDerivedValue(() => { | ||
return interpolate(progress.value, [0, 1], [1, 0.75], Extrapolate.CLAMP); | ||
}); | ||
const borderRadius = useDerivedValue(() => { | ||
return interpolate(progress.value, [0, 1], [0, 30], Extrapolate.CLAMP); | ||
}); | ||
const rotate = useDerivedValue(() => { | ||
return interpolate(progress.value, [0, 1], [0, 10], Extrapolate.CLAMP); | ||
}); | ||
|
||
const animatedStyle = useAnimatedStyle(() => { | ||
return { | ||
transform: [{ scale: scale.value }, { rotateZ: -rotate.value + "deg" }], | ||
borderRadius: borderRadius.value, | ||
}; | ||
}); | ||
return ( | ||
<Animated.View style={[styles.container, animatedStyle, style]}> | ||
{children} | ||
</Animated.View> | ||
); | ||
}; | ||
|
||
export default ScaledView; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
paddingHorizontal: 16, | ||
backgroundColor: "#fff", | ||
paddingTop: StatusBar.currentHeight, | ||
}, | ||
}); |
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
Oops, something went wrong.