Skip to content

Conversation

@akwasniewski
Copy link
Contributor

@akwasniewski akwasniewski commented Dec 2, 2025

Description

Made a new PR, as it is easier than attempt to merge the old one with next.

This PR adds a toggle in the example app to switch between Legacy and V3 api examples. In the new api section I added split into few sections. Most of them are rewritten old V2 examples with more consistent styling.
I also added a Feedback component to showcase features console free.
The new examples are:

  • basic examples for every gestures
  • lock to showcase combining gestures
  • sharedValue, nestedText, svg - to showcase VirtualDetector
  • animated - to showcase cooperation with animated

Test plan

See if the examples in new api section from common-example work

@akwasniewski akwasniewski changed the base branch from main to next December 2, 2025 10:18
@akwasniewski akwasniewski mentioned this pull request Dec 2, 2025
9 tasks
@akwasniewski akwasniewski changed the title examples V3 examples Dec 2, 2025
@akwasniewski akwasniewski marked this pull request as ready for review December 15, 2025 21:31
Copy link
Member

@j-piasecki j-piasecki left a comment

Choose a reason for hiding this comment

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

I've been seeing

[Worklets] Tried to modify key current of an object which has been already passed to a worklet. See
https://docs.swmansion.com/react-native-reanimated/docs/guides/troubleshooting#tried-to-modify-key-of-an-object-which-has-been-converted-to-a-shareable
for more details.

when running the examples (Svg for example). Could you investigate it?

</View>
<Text style={styles.instructions}>
The ball has simultanous pan and longPress gestures. Upon update pan
changes minDistanceof longPress, such that longPress will fail if is
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
changes minDistanceof longPress, such that longPress will fail if is
changes maxDistance of longPress, such that longPress will fail if it's

});
},
minDuration: 1000,
maxDistance: maxLongPressDistance,
Copy link
Member

Choose a reason for hiding this comment

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

On iOS, maxDistance doesn't seem to do anything. Could you investigate that?

return (
<View style={styles.container}>
<GestureDetector gesture={panGesture}>
<Animated.View
Copy link
Member

Choose a reason for hiding this comment

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

I like this one! Can it also change background color on onBegin?

Comment on lines +35 to +37
<ButtonWrapper ButtonComponent={BaseButton} color={COLORS.KINDA_BLUE} />
<ButtonWrapper ButtonComponent={RectButton} color={COLORS.NAVY} />
<ButtonWrapper ButtonComponent={BorderlessButton} color={COLORS.PURPLE} />
Copy link
Member

Choose a reason for hiding this comment

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

They only console.log when pressed, should they also show some message on screen?

SHOW_LEGACY_EXAMPLES_KEY,
]).then(([openLastExample, lastExample, showLegacyExamples]) => {
const showLegacy = showLegacyExamples[1] === 'true';
if (showLegacyExamples[1]) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (showLegacyExamples[1]) {
if (showLegacyExamples[1] != null) {

I'm not sure whether this is what this check was supposed to do, or whether it should check showLegacy - imo it should be explicit.

onActivate: () => {
'worklet';
runOnJS(startRecording)();
captureProgress.value = withTiming(1, { duration: VIDEO_DURATION });
Copy link
Member

Choose a reason for hiding this comment

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

I think this is missing easing: Easing.linear - the animation speeds up and slows down.

// Tap to lock
const tap = useTapGesture({
onDeactivate: () => {
'worklet';
Copy link
Member

Choose a reason for hiding this comment

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

If you use the latest react-native-worklets, this directive should be auto-included. Maybe it's worth it to update worklets and remove the directive?

@@ -0,0 +1,156 @@
import { COLORS, Feedback } from '../../../common';
Copy link
Member

Choose a reason for hiding this comment

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

This is not platform-specific, it just requires additional hardware on mobile (mouse, stylus).

<View style={styles.subcontainer}>
<View style={styles.row}>
<Text style={styles.text}>Overlap Siblings</Text>
<InterceptingGestureDetector>
Copy link
Member

Choose a reason for hiding this comment

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

Out of curiosity, why InterceptingGestureDetector here?

<View style={styles.row}>
<Text style={styles.text}>Overlap Child</Text>

<InterceptingGestureDetector>
Copy link
Member

Choose a reason for hiding this comment

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

Same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants