Skip to content

Refactor TabController to use Reanimated v2 API #1325

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
merged 33 commits into from
Jun 27, 2021
Merged

Conversation

ethanshar
Copy link
Collaborator

@ethanshar ethanshar commented May 31, 2021

Description

  • Migrate all components from class to function components
  • Migrate all reanimated v1 API to v2 - no more <Code/> blocks, now we're using shared values and animated styles.
  • The component is currently exported as TabController2 - Incubator.TabController already taken. Also this change doesn't introduce breaking changes and should work the same, therefor we'll gradually migrate to it.
  • General cleanups and example screen improvements

Changelog

Reimplement TabController component with reanimated v2 API (currently exported as TabController2)

@ethanshar ethanshar marked this pull request as draft May 31, 2021 15:08
@ethanshar ethanshar changed the title WIP - Refactor TabController to use Reanimated v2 API Refactor TabController to use Reanimated v2 API Jun 20, 2021
@ethanshar ethanshar marked this pull request as ready for review June 20, 2021 13:33
@ethanshar ethanshar requested a review from M-i-k-e-l June 20, 2021 13:37
@ethanshar ethanshar added the Important for Next Release PR that must be included in the release version label Jun 21, 2021
@ethanshar ethanshar requested a review from M-i-k-e-l June 22, 2021 16:08
Comment on lines +120 to +121
const sharedLabelStyle = useSharedValue(JSON.parse(JSON.stringify(labelStyle)));
const sharedSelectedLabelStyle = useSharedValue(JSON.parse(JSON.stringify(selectedLabelStyle)));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this can be solved using only:

const sharedLabelStyle = useSharedValue(labelStyle);
const sharedSelectedLabelStyle = useSharedValue(selectedLabelStyle);

and in animatedLabelStyle returning:

return (isActive ? sharedSelectedLabelStyle.value : sharedLabelStyle.value) || {};

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue this solves wasn't exposed cause some code is commented out in the example screen
I pushed a code the expose the bug -> ff8c461

@M-i-k-e-l M-i-k-e-l merged commit ab1a247 into master Jun 27, 2021
@ethanshar ethanshar deleted the feat/TabControllerV2 branch April 18, 2022 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Important for Next Release PR that must be included in the release version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants