Skip to content

Commit

Permalink
web
Browse files Browse the repository at this point in the history
  • Loading branch information
haileyok committed Sep 16, 2024
1 parent 0e61907 commit b15008a
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions src/view/com/home/HomeHeaderLayout.web.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import React from 'react'
import {StyleSheet, View} from 'react-native'
import Animated from 'react-native-reanimated'
import Animated, {
useAnimatedStyle,
useReducedMotion,
useSharedValue,
withDelay,
withRepeat,
withSequence,
withSpring,
withTiming,
} from 'react-native-reanimated'
import {msg} from '@lingui/macro'
import {useLingui} from '@lingui/react'

Expand Down Expand Up @@ -40,6 +49,43 @@ function HomeHeaderLayoutDesktopAndTablet({
const {hasSession} = useSession()
const {_} = useLingui()

// TEMPORARY - REMOVE AFTER MILLY
// This will just cause the icon to shake a bit when the user first opens the app, drawing attention to the celebration
// 🎉
const rotate = useSharedValue(0)
const reducedMotion = useReducedMotion()

// Run this a single time on app mount.
React.useEffect(() => {
if (reducedMotion) return

// Waits 1500ms, then rotates 10 degrees with a spring animation. Repeats once.
rotate.value = withDelay(
1000,
withRepeat(
withSequence(
withTiming(10, {duration: 100}),
withSpring(0, {
mass: 1,
damping: 1,
stiffness: 200,
overshootClamping: false,
}),
),
2,
false,
),
)
}, [rotate, reducedMotion])

const animatedStyle = useAnimatedStyle(() => ({
transform: [
{
rotateZ: `${rotate.value}deg`,
},
],
}))

return (
<>
{hasSession && (
Expand All @@ -56,7 +102,7 @@ function HomeHeaderLayoutDesktopAndTablet({
t.atoms.border_contrast_low,
styles.bar,
]}>
<View
<Animated.View
style={[
a.absolute,
a.inset_0,
Expand All @@ -65,6 +111,7 @@ function HomeHeaderLayoutDesktopAndTablet({
{
width: 28,
},
animatedStyle,
]}>
<Trigger>
{ctx => (
Expand All @@ -77,7 +124,7 @@ function HomeHeaderLayoutDesktopAndTablet({
)}
</Trigger>
{/* <Logo width={28} /> */}
</View>
</Animated.View>

<Link
to="/feeds"
Expand Down

0 comments on commit b15008a

Please sign in to comment.