-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[🐴] Only scroll down one "screen" in height when foregrounding (#4027)
* maintain position after foreground * one possibility * don't overscroll when content size changes. * ignore the rule on 1 item * fix * [🐴] Pill for additional unreads when coming from background (#4043) * create a pill with some animatons * add some basic styles to the pill * make the animations reusable * bit better styling * rm logs --------- Co-authored-by: Samuel Newman <[email protected]> * import --------- Co-authored-by: Samuel Newman <[email protected]>
- Loading branch information
Showing
3 changed files
with
136 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react' | ||
import {View} from 'react-native' | ||
import Animated from 'react-native-reanimated' | ||
import {Trans} from '@lingui/macro' | ||
|
||
import { | ||
ScaleAndFadeIn, | ||
ScaleAndFadeOut, | ||
} from 'lib/custom-animations/ScaleAndFade' | ||
import {atoms as a, useTheme} from '#/alf' | ||
import {Text} from '#/components/Typography' | ||
|
||
export function NewMessagesPill() { | ||
const t = useTheme() | ||
|
||
React.useEffect(() => {}, []) | ||
|
||
return ( | ||
<Animated.View | ||
style={[ | ||
a.py_sm, | ||
a.rounded_full, | ||
a.shadow_sm, | ||
a.border, | ||
t.atoms.bg_contrast_50, | ||
t.atoms.border_contrast_medium, | ||
{ | ||
position: 'absolute', | ||
bottom: 70, | ||
width: '40%', | ||
left: '30%', | ||
alignItems: 'center', | ||
shadowOpacity: 0.125, | ||
shadowRadius: 12, | ||
shadowOffset: {width: 0, height: 5}, | ||
}, | ||
]} | ||
entering={ScaleAndFadeIn} | ||
exiting={ScaleAndFadeOut}> | ||
<View style={{flex: 1}}> | ||
<Text style={[a.font_bold]}> | ||
<Trans>New messages</Trans> | ||
</Text> | ||
</View> | ||
</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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {withTiming} from 'react-native-reanimated' | ||
|
||
export function ScaleAndFadeIn() { | ||
'worklet' | ||
|
||
const animations = { | ||
opacity: withTiming(1), | ||
transform: [{scale: withTiming(1)}], | ||
} | ||
|
||
const initialValues = { | ||
opacity: 0, | ||
transform: [{scale: 0.7}], | ||
} | ||
|
||
return { | ||
animations, | ||
initialValues, | ||
} | ||
} | ||
|
||
export function ScaleAndFadeOut() { | ||
'worklet' | ||
|
||
const animations = { | ||
opacity: withTiming(0), | ||
transform: [{scale: withTiming(0.7)}], | ||
} | ||
|
||
const initialValues = { | ||
opacity: 1, | ||
transform: [{scale: 1}], | ||
} | ||
|
||
return { | ||
animations, | ||
initialValues, | ||
} | ||
} |
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