-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Layout] Bleed profile banner into safe area (#6967)
* bleed profile banner into safe area (cherry picked from commit 50b3a4d) * pointer events none when hidden (cherry picked from commit bae2c7b) * fix web (cherry picked from commit e3f9597) * add status bar shadow * rm log * rm mini header * speed up animation * pass bool rather than int in light status bar
- Loading branch information
Showing
14 changed files
with
322 additions
and
47 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
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
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,56 @@ | ||
import Animated, {SharedValue, useAnimatedStyle} from 'react-native-reanimated' | ||
import {useSafeAreaInsets} from 'react-native-safe-area-context' | ||
import {LinearGradient} from 'expo-linear-gradient' | ||
|
||
import {isIOS} from '#/platform/detection' | ||
import {usePagerHeaderContext} from '#/view/com/pager/PagerHeaderContext' | ||
import {atoms as a} from '#/alf' | ||
|
||
const AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient) | ||
|
||
export function StatusBarShadow() { | ||
const {top: topInset} = useSafeAreaInsets() | ||
const pagerContext = usePagerHeaderContext() | ||
|
||
if (isIOS && pagerContext) { | ||
const {scrollY} = pagerContext | ||
return <StatusBarShadowInnner scrollY={scrollY} /> | ||
} | ||
|
||
return ( | ||
<LinearGradient | ||
colors={['rgba(0,0,0,0.5)', 'rgba(0,0,0,0)']} | ||
style={[ | ||
a.absolute, | ||
a.z_10, | ||
{height: topInset, top: 0, left: 0, right: 0}, | ||
]} | ||
/> | ||
) | ||
} | ||
|
||
function StatusBarShadowInnner({scrollY}: {scrollY: SharedValue<number>}) { | ||
const {top: topInset} = useSafeAreaInsets() | ||
|
||
const animatedStyle = useAnimatedStyle(() => { | ||
return { | ||
transform: [ | ||
{ | ||
translateY: Math.min(0, scrollY.get()), | ||
}, | ||
], | ||
} | ||
}) | ||
|
||
return ( | ||
<AnimatedLinearGradient | ||
colors={['rgba(0,0,0,0.5)', 'rgba(0,0,0,0)']} | ||
style={[ | ||
animatedStyle, | ||
a.absolute, | ||
a.z_10, | ||
{height: topInset, top: 0, left: 0, right: 0}, | ||
]} | ||
/> | ||
) | ||
} |
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,3 @@ | ||
export function StatusBarShadow() { | ||
return null | ||
} |
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.