Conversation
|
Note that I temporarily reverted the broken changes in the shadow node. Without it, the pressable breaks on both android and ios. This change will be reverted before merge. |
| export type { | ||
| PressableProps, | ||
| PressableStateCallbackType, | ||
| } from './components/Pressable'; | ||
| export { default as Pressable } from './components/Pressable'; | ||
| PressableProps as LegacyPressableProps, | ||
| PressableStateCallbackType as LegacyPressableCallbackType, | ||
| } from './v3/components/Pressable'; | ||
| export { default as LegacyPressable } from './v3/components/Pressable'; |
There was a problem hiding this comment.
I don't think the new one should be exported as Legacy (and we probably want to export the legacy one).
There was a problem hiding this comment.
Forgot to remove 'v3' from path yesterday 😅. Fixed in ae6e532
There was a problem hiding this comment.
The new one is not exported, no?
There was a problem hiding this comment.
It is exported, I added it to v3/index and we reexport everything from there.
m-bert
left a comment
There was a problem hiding this comment.
Previously in Pressable we had:
for (const gesture of gestures) {
gesture.enabled(isPressableEnabled);
gesture.runOnJS(true);
gesture.hitSlop(appliedHitSlop);
Object.entries(relationProps).forEach(([relationName, relation]) => {
applyRelationProp(
gesture,
relationName as RelationPropName,
relation as RelationPropType
);
});
}don't new gestures miss enabled and hitSlop?
Also, I don't really like that a lot of code is duplicated. I know that splitting Pressable component may not be worth it, but I don't think it makes sense to duplicate things such as StateMachine (cc @j-piasecki).
packages/react-native-gesture-handler/src/v3/components/Pressable.tsx
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/components/Pressable/Pressable.tsx
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/components/Pressable/Pressable.tsx
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/components/Pressable/Pressable.tsx
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/components/Pressable/Pressable.tsx
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/components/Pressable/PressableProps.tsx
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/components/Pressable/StateMachine.tsx
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/components/Pressable/stateDefinitions.ts
Outdated
Show resolved
Hide resolved
packages/react-native-gesture-handler/src/v3/components/Pressable/utils.ts
Outdated
Show resolved
Hide resolved
…ble/Pressable.tsx Co-authored-by: Michał Bert <63123542+m-bert@users.noreply.github.com>
Co-authored-by: Michał Bert <63123542+m-bert@users.noreply.github.com>
…ble/Pressable.tsx Co-authored-by: Michał Bert <63123542+m-bert@users.noreply.github.com>
…ble/Pressable.tsx Co-authored-by: Michał Bert <63123542+m-bert@users.noreply.github.com>
packages/react-native-gesture-handler/src/v3/components/Pressable.tsx
Outdated
Show resolved
Hide resolved
m-bert
left a comment
There was a problem hiding this comment.
Looks good, please make sure that other Pressable examples work before merging.
Note
Some of them may crash at manual activation, it was fixed on main but not yet cherry-picked to next
Description
V3 implementation of pressable component
Test plan
Tested on the following example