-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8976 from LedgerHQ/feat/LIVE-16502
💄 (llm) animation enhancement tab switch
- Loading branch information
Showing
14 changed files
with
499 additions
and
157 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,5 @@ | ||
--- | ||
"live-mobile": minor | ||
--- | ||
|
||
Enhance switch tab animation on portfolioassets for the assets and accounts tabs |
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
46 changes: 46 additions & 0 deletions
46
apps/ledger-live-mobile/src/screens/Portfolio/AnimatedContainer.tsx
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,46 @@ | ||
import React, { useCallback } from "react"; | ||
import Animated, { | ||
Easing, | ||
useAnimatedStyle, | ||
useSharedValue, | ||
withTiming, | ||
} from "react-native-reanimated"; | ||
import { Box } from "@ledgerhq/native-ui"; | ||
|
||
export interface AnimatedContainerProps { | ||
children: React.ReactNode; | ||
onHeightChange?: (height: number) => void; | ||
} | ||
|
||
const ANIMATION_TIMING_CONFIG = { | ||
duration: 200, | ||
easing: Easing.bezier(0.3, 0, 0, 1), | ||
} as const; | ||
|
||
export const AnimatedContainer = ({ children, onHeightChange }: AnimatedContainerProps) => { | ||
const animatedHeight = useSharedValue(1); | ||
|
||
const style = useAnimatedStyle(() => ({ | ||
height: withTiming(animatedHeight.value, ANIMATION_TIMING_CONFIG), | ||
overflow: "hidden", | ||
})); | ||
|
||
const onLayout = useCallback( | ||
(event: { nativeEvent: { layout: { height: number } } }) => { | ||
const height = event.nativeEvent.layout.height; | ||
if (height === 0) return; | ||
|
||
animatedHeight.value = height; | ||
onHeightChange?.(height); | ||
}, | ||
[animatedHeight, onHeightChange], | ||
); | ||
|
||
return ( | ||
<Animated.View style={style}> | ||
<Box onLayout={onLayout}>{children}</Box> | ||
</Animated.View> | ||
); | ||
}; | ||
|
||
export default AnimatedContainer; |
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
Oops, something went wrong.