-
Notifications
You must be signed in to change notification settings - Fork 2
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
[IOAPPX-428] Add the new useScaleAnimation
and useListItemAnimation
hooks + Add support for the reducedMotion
a11y setting
#358
Conversation
useScaleAnimation
and useListItemAnimation
hooks + Add support for the 'Reduce Motion' a11y setting
useScaleAnimation
and useListItemAnimation
hooks + Add support for the 'Reduce Motion' a11y settinguseScaleAnimation
and useListItemAnimation
hooks + Add support for the reducedMotion
a11y setting
…6447) ## Short description This PR introduces a feature that allows users to view a credential's skeuomorphic card in full-screen mode. This mode can be activated by tapping the card on the credential details screen. ## List of changes proposed in this pull request - Added `useScaleAnimation` hook (to be removed once this PR is merged: pagopa/io-app-design-system#358) - Added `FlipGestureDetector` component, which handles swipe gestures to flip the skeumorphic cards in the credential details screen - Updated `FlippableCard` component in order to handle an optional `orientation` prop, which changes the axis type for the flip animation - Updated `ItwSkeumorphicCard` component in roder to handle an optional `orientation` prop, which rotates the card and adjust its scale to fit the screen correctly. - Refactored `getCredentialStatus` and `itwCredentialStatusSelector`: - Extracted logic from `itwCredentialStatusSelector` and moved it to `getCredentialStatusObject`, `getCredentialStatusObject` can be freely used without relying to the redux store and `itwCredentialStatusSelector` for the memoized value - Moved `getCredentialStatus` and `getCredentialStatusObject` to `itwCredentialStatusUtils.ts` file - Added `ItwPresentationCredentialCardModal` in the IT Wallet navigation stack - Updated IT Wallet playgrounds to test the new feature ## How to test 1. Navigate to the credential details screen or the IT Wallet playground in the settings screen. 2. Tap on a skeuomorphic credential card to view it in full-screen mode. 3. Verify the following: - The card is rendered correctly in full-screen mode. - The screen brightness gently increases when entering full-screen mode. - The screen brightness reverts to its original value upon exiting full-screen mode. ## Preview https://github.com/user-attachments/assets/66743a6f-ea96-4de3-a150-f88ccfa30eea
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests on the iOS simulator look promising. I haven’t noticed significant differences compared to the default behavior. It would be great if someone else could test as well to confirm.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test on real devices, works as expected!
Short description
This PR improves the overall code quality by removing a lot of repeated code. This change is possible thanks to the new
useScaleAnimation
anduseListItemAnimation
hooks. This PR also adds support for the Reduce motion a11y setting.useScaleAnimation
should be used when you want a simple scale effect, like the one applied toButton…
orModule…
componentsuseListItemAnimation
should be used when you want to build anotherListItem…
component and you can't usePressableListItemBase
for various reasonsBoth hooks use the
useSpringPressProgressValue
hook at their core.List of changes proposed in this pull request
useScaleAnimation
anduseListItemAnimation
hooksIOScaleValues
toIOScaleEffect
, improve naming of its keysuseScaleAnimation
hook to the following components:PressableModuleBase
, so all theModule…
componentsAlert…
componentsBanner
TabItem
NumberButton
useListItemAnimation
hook to all the interactiveListItem…
componentsModule…
components where it's still applied, but with a less pronounced effectuseListItemSpringAnimation
withuseListItemAnimation
useModuleSpringAnimation
withuseScaleAnimation
Preview
When
reducedMotion
is enabled, the scale effect won't be applied:disabled-scale-effect.mp4
How to test
Go to all the components that use a scale effect and check that there are no regressions.