-
Notifications
You must be signed in to change notification settings - Fork 4k
[UX Reliability] Improve the bottom modal animations #55157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mountiny
merged 49 commits into
Expensify:main
from
software-mansion-labs:@BartoszGrajdek/react-native-modal-refactor
Feb 18, 2025
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
fb2f774
feat: change modal animation library
BartoszGrajdek 1d83349
Merge remote-tracking branch 'origin/main' into @BartoszGrajdek/react…
BartoszGrajdek 442b29d
adding some types, and do some refactor
sumo-slonik 0770e20
working on null handling and linter problems
sumo-slonik 51e30ab
Merge branch '@BartoszGrajdek/react-native-modal-refactor' into @Bart…
sumo-slonik fed11de
fix types and build error
sumo-slonik e51ff8a
fix linters problems
sumo-slonik 61d4bf3
fix typo in TransactionType
sumo-slonik e7b1bb5
fix permissions issue
sumo-slonik 2d43ab0
fix issue with to little height of container
sumo-slonik ed4e2e9
Merge branch 'main' into @BartoszGrajdek/react-native-modal-refactor-…
sumo-slonik 3ad4eab
fix problem with no handling gestures
sumo-slonik 1e78131
Merge pull request #133 from software-mansion-labs/@BartoszGrajdek/re…
sumo-slonik fc04fa1
refactor: ts & eslint cleanup
BartoszGrajdek ad079da
add callbacks to animations instead of timeout
sumo-slonik dd1ff93
fix hideModalContentWhileAnimating
sumo-slonik 96de617
work in progress on any types
sumo-slonik b2ab25c
fix emoji picker tab
sumo-slonik 5c2b0f6
add swipe animations using react reanimate
sumo-slonik a95e496
refactor and clean code
sumo-slonik d9d2df3
Update SearchRouterModal.tsx
sumo-slonik 6ac6696
changes from Bartek CR
sumo-slonik 525f9ca
Merge remote-tracking branch 'origin/main' into @BartoszGrajdek/react…
BartoszGrajdek 50ea848
Merge branch '@BartoszGrajdek/react-native-modal-refactor' into @Bart…
sumo-slonik 61f207a
feat: add handling for different modal types
BartoszGrajdek dee6299
Merge branch '@BartoszGrajdek/react-native-modal-refactor' into @Bart…
sumo-slonik 0312e11
fix merge problems
sumo-slonik afcb7db
Modal code refactor
BartoszGrajdek 17fbefe
[49354] Migrate react-native-modal to reanimated
BartoszGrajdek 757aaa6
chore: resolve merge conflicts
BartoszGrajdek 6735c18
refactor: address review comments & remove gesture handling
BartoszGrajdek ed6f506
Merge remote-tracking branch 'origin/main' into @BartoszGrajdek/react…
BartoszGrajdek 5daefab
fix: enable new modal in PopoverWithMeasuredContent-related components
BartoszGrajdek 27271a8
chore: resolve merge conflicts
BartoszGrajdek d400ad4
fix: floating action button performance issues
BartoszGrajdek bd4d1cd
refactor: remove duplicated opacity on modal backdrop
BartoszGrajdek 02d93f8
fix: bottom-docked modal regressions
BartoszGrajdek 10ddb0b
fix: TS error
BartoszGrajdek 0fd231d
Merge remote-tracking branch 'origin/main' into @BartoszGrajdek/react…
BartoszGrajdek 14b1d84
fix: keyframe mock
BartoszGrajdek 495d21b
chore: migrate only FAB
BartoszGrajdek 9f5ae9b
chore: remove unnecessary changes
BartoszGrajdek 6b7ef68
fix: reanimated keyframe easing
BartoszGrajdek 24c77d0
fix: reanimated keyframe easing
BartoszGrajdek 70bf577
chore: resolve merge conflicts
BartoszGrajdek 38a61f3
chore: resolve merge conflicts
BartoszGrajdek e57e097
Merge remote-tracking branch 'origin/main' into @BartoszGrajdek/react…
BartoszGrajdek caa8d4e
chore: resolve merge conflicts
BartoszGrajdek 4d87305
refactor: move animation timing to CONST & add display names
BartoszGrajdek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,92 @@ | ||
| import React, {useMemo} from 'react'; | ||
| import Animated, {Easing, Keyframe} from 'react-native-reanimated'; | ||
| import type {ReanimatedKeyframe} from 'react-native-reanimated/lib/typescript/layoutReanimation/animationBuilder/Keyframe'; | ||
| import type {BackdropProps} from '@components/Modal/BottomDockedModal/types'; | ||
| import {PressableWithoutFeedback} from '@components/Pressable'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import CONST from '@src/CONST'; | ||
|
|
||
| const easing = Easing.bezier(0.76, 0.0, 0.24, 1.0); | ||
|
|
||
| /** | ||
| * Due to issues with react-native-reanimated Keyframes the easing type doesn't account for bezier functions | ||
| * and we also need to use internal .build() function to make the easing apply on each mount. | ||
| * | ||
| * This causes problems with both eslint & Typescript and is going to be fixed in react-native-reanimated 3.17 with these PRs merged: | ||
| * https://github.com/software-mansion/react-native-reanimated/pull/6960 | ||
| * https://github.com/software-mansion/react-native-reanimated/pull/6958 | ||
| * | ||
| * Once that's added we can apply our changes to files in BottomDockedModal/Backdrop/*.tsx and BottomDockedModal/Container/*.tsx | ||
| */ | ||
|
|
||
| /* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
| function Backdrop({ | ||
| style, | ||
| customBackdrop, | ||
| onBackdropPress, | ||
| animationInTiming = CONST.MODAL.ANIMATION_TIMING.DEFAULT_IN, | ||
| animationOutTiming = CONST.MODAL.ANIMATION_TIMING.DEFAULT_OUT, | ||
| }: BackdropProps) { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
|
|
||
| const Entering = useMemo(() => { | ||
| const FadeIn = new Keyframe({ | ||
| from: {opacity: 0}, | ||
| to: { | ||
| opacity: 0.72, | ||
| // @ts-expect-error Types mismatch in reanimated, should to be fixed in 3.17 | ||
| easing, | ||
| }, | ||
| }); | ||
|
|
||
| // @ts-expect-error Internal function used to fix easing issue, should to be fixed in 3.17 | ||
| return FadeIn.duration(animationInTiming).build() as ReanimatedKeyframe; | ||
| }, [animationInTiming]); | ||
|
|
||
| const Exiting = useMemo(() => { | ||
| const FadeOut = new Keyframe({ | ||
| from: {opacity: 0.72}, | ||
| to: { | ||
| opacity: 0, | ||
| // @ts-expect-error Types mismatch in reanimated, should to be fixed in 3.17 | ||
| easing, | ||
| }, | ||
| }); | ||
|
|
||
| // @ts-expect-error Internal function used to fix easing issue, should to be fixed in 3.17 | ||
| return FadeOut.duration(animationOutTiming).build() as ReanimatedKeyframe; | ||
| }, [animationOutTiming]); | ||
|
|
||
| const BackdropOverlay = useMemo( | ||
| () => ( | ||
| <Animated.View | ||
| entering={Entering} | ||
| exiting={Exiting} | ||
| style={[styles.modalBackdrop, style]} | ||
| > | ||
| {!!customBackdrop && customBackdrop} | ||
| </Animated.View> | ||
| ), | ||
| [Entering, Exiting, customBackdrop, style, styles.modalBackdrop], | ||
| ); | ||
|
|
||
| if (!customBackdrop) { | ||
| return ( | ||
| <PressableWithoutFeedback | ||
| accessible | ||
| accessibilityLabel={translate('modal.backdropLabel')} | ||
| onPressIn={onBackdropPress} | ||
| > | ||
| {BackdropOverlay} | ||
| </PressableWithoutFeedback> | ||
| ); | ||
| } | ||
|
|
||
| return BackdropOverlay; | ||
| } | ||
|
BartoszGrajdek marked this conversation as resolved.
|
||
|
|
||
| Backdrop.displayName = 'Backdrop'; | ||
|
|
||
| export default Backdrop; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.