-
Notifications
You must be signed in to change notification settings - Fork 734
Reanimated and GestureHandler upgrade #3203
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
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
8f76e95
SectionsWheelPicker - wrap with GestureHandlerRootView
Inbal-Tish 1b1c725
remove redundent
Inbal-Tish adcaf4a
remove // @ts-expect-error should be fixed in version 3.5 (https://gi…
Inbal-Tish e8f970c
Modal - applying useGestureHandlerRootView on iOS as well
Inbal-Tish 66e0b0c
TouchableOpacity - migrate from deprecated onGestureEvent to onHandle…
Inbal-Tish 88ef194
PanView - migrate from PanGestureHandler with deprecated onGestureEve…
Inbal-Tish c501fc4
Calendar header - ignore TS error
Inbal-Tish 97a0973
upgrade libraries
Inbal-Tish c54cafe
gesture upgrade to 2.16.0
Inbal-Tish 28b750a
gestureHandler to 2.14.1
Inbal-Tish 70d2a05
Modal - update docs
Inbal-Tish 418fbd2
WheelPicker - wrap with GestureHandlerRootView, instead of wrapping t…
Inbal-Tish 36ec4a6
Wrapping SectionWheelPickerScreen instead of WheelPicker component
Inbal-Tish 8324ef9
clean
Inbal-Tish 7957805
Remove migration from useAnimatedGestureHandler
Inbal-Tish 03a695c
//@ts-expect-error - useAnimatedGestureHandler migration
Inbal-Tish 323a558
fix TS error on ConnectionStatusBar NetInfo.fetch
Inbal-Tish 6a545d4
Revert "fix TS error on ConnectionStatusBar NetInfo.fetch"
Inbal-Tish 98d62a3
Revert "//@ts-expect-error - useAnimatedGestureHandler migration"
Inbal-Tish c616f07
Revert "Remove migration from useAnimatedGestureHandler"
Inbal-Tish 3c6c796
Wrap screens with gestureHandlerRootHOC
Inbal-Tish a3bcdc7
Merge branch 'master' into fix/GestureHandlerRootView
M-i-k-e-l df8f1b8
Fix TabController's indicator
M-i-k-e-l ae5b10f
Fix PanView (and screen)
M-i-k-e-l 167c3b6
Remove missed comment
M-i-k-e-l a07caac
Change to map (also fixes initial indicator)
M-i-k-e-l 1e21608
Revert "Change to map (also fixes initial indicator)"
M-i-k-e-l 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
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
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 |
---|---|---|
|
@@ -128,13 +128,6 @@ const useScrollToItem = <T extends ScrollToSupportedViews>(props: ScrollToItemPr | |
const rightOffsets = []; | ||
rightOffsets.push(-containerWidth + widths[0] + outerSpacing + innerSpacing); | ||
while (index < itemsCount) { | ||
/* map animated widths and offsets */ | ||
itemsWidthsAnimated.value[index] = widths[index]; | ||
if (index > 0) { | ||
itemsOffsetsAnimated.value[index] = | ||
itemsOffsetsAnimated.value[index - 1] + itemsWidthsAnimated.value[index - 1]; | ||
} | ||
|
||
/* calc center, left and right offsets */ | ||
centeredOffsets[index] = currentCenterOffset - screenCenter + widths[index] / 2; | ||
++index; | ||
|
@@ -154,9 +147,24 @@ const useScrollToItem = <T extends ScrollToSupportedViews>(props: ScrollToItemPr | |
|
||
setOffsets({CENTER: centeredOffsets, LEFT: leftOffsets, RIGHT: rightOffsets}); // default for DYNAMIC is CENTER | ||
|
||
// trigger value change | ||
itemsWidthsAnimated.value = [...itemsWidthsAnimated.value]; | ||
itemsOffsetsAnimated.value = [...itemsOffsetsAnimated.value]; | ||
// Update shared values | ||
itemsWidthsAnimated.modify((value) => { | ||
'worklet'; | ||
value.forEach((_, index) => { | ||
value[index] = widths[index]; | ||
}); | ||
return value; | ||
}); | ||
|
||
itemsOffsetsAnimated.modify((value) => { | ||
'worklet'; | ||
value.forEach((_, index) => { | ||
if (index > 0) { | ||
value[index] = value[index - 1] + widths[index - 1]; | ||
} | ||
}); | ||
Comment on lines
+161
to
+165
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, consider using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It appears that accessing value[index - 1] gives |
||
return value; | ||
}); | ||
}, | ||
[itemsCount, outerSpacing, innerSpacing, addOffsetMargin, containerWidth]); | ||
|
||
|
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
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
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.
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.
There's something a little confusing when you both update the value and return it.
Maybe use
map
instead offorEach
and return it, it might even shorten thisThere 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.
Tried it but it caused a TS error I could not find a fix for.