-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add corner area detection to Fling gesture. #2807
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 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a00e77d
First working version of corner area fill.
latekvo 38fd333
Moved computationally heavy tasks out of the main loop.
latekvo 705f13a
Fix eslint and style errors.
latekvo feecc9b
Create new fling example to basic examples.
latekvo 0c3b702
Fix eslint errors.
latekvo f22a1ab
Fix eslint errors.
latekvo 31a9511
Merge branch 'main' into @latekvo/fix_fling_alignment
latekvo 91013e2
Eslint fixes, previous ones turned out to use a wrong version of pret…
latekvo 09513a3
Merge branch '@latekvo/fix_fling_alignment' of https://github.com/sof…
latekvo cf549a6
Apply suggestions to fling example.
latekvo 129364b
Remove composite directions, merged them with normal directions.
latekvo dc2de85
Make max deviation angle simpler.
latekvo f835562
Fix naming.
latekvo 142c989
fix eslint ignore statement.
latekvo 6b8dd4e
applied review suggestions
latekvo 6dab745
apply review and eslint suggestions, general cleanup
latekvo 9805ba5
added diagonal gesture detection support to kotlin
latekvo 00b127e
gradle spotless checks fix
latekvo df5c71c
removed composite directions in favour of having separate diagonal an…
latekvo 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import React from 'react'; | ||
| import { StyleSheet, View } from 'react-native'; | ||
| import { | ||
| Directions, | ||
| Gesture, | ||
| GestureDetector, | ||
| } from 'react-native-gesture-handler'; | ||
| import Animated, { | ||
| useSharedValue, | ||
| useAnimatedStyle, | ||
| withTiming, | ||
| Easing, | ||
| } from 'react-native-reanimated'; | ||
|
|
||
| export default function Example() { | ||
| const position = useSharedValue(0); | ||
| const beginPosition = useSharedValue(0); | ||
|
|
||
| const flingGesture = Gesture.Fling() | ||
| .direction(Directions.LEFT | Directions.RIGHT) | ||
| .onBegin((e) => { | ||
| beginPosition.value = e.x; | ||
| }) | ||
| .onStart((e) => { | ||
| const direction = Math.sign(e.x - beginPosition.value); | ||
| position.value = withTiming(position.value + direction * 50, { | ||
| duration: 300, | ||
| easing: Easing.bounce, | ||
| }); | ||
| }); | ||
|
|
||
| const animatedStyle = useAnimatedStyle(() => ({ | ||
| transform: [{ translateX: position.value }], | ||
| })); | ||
|
|
||
| return ( | ||
| <View style={styles.centerView}> | ||
| <GestureDetector gesture={flingGesture}> | ||
| <Animated.View style={[styles.box, animatedStyle]} /> | ||
| </GestureDetector> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| const styles = StyleSheet.create({ | ||
| centerView: { | ||
| flex: 1, | ||
| justifyContent: 'center', | ||
| alignItems: 'center', | ||
| }, | ||
| box: { | ||
| height: 120, | ||
| width: 120, | ||
| backgroundColor: '#b58df1', | ||
| marginBottom: 30, | ||
| }, | ||
| }); |
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
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.