File tree Expand file tree Collapse file tree
packages/react-native-gesture-handler Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,11 +275,12 @@ - (void)handleTouchUpOutside:(UIView *)sender forEvent:(UIEvent *)event
275275
276276- (void )handleTouchUpInside : (UIView *)sender forEvent : (UIEvent *)event
277277{
278- [self sendEventsInState: RNGestureHandlerStateEnd
279- forViewWithTag: sender.reactTag
280- withExtraData: [RNGestureHandlerEventExtraData forPointerInside: YES
281- withNumberOfTouches: event.allTouches.count
282- withPointerType: _pointerType]];
278+ RNGestureHandlerEventExtraData *extraData = [RNGestureHandlerEventExtraData forPointerInside: YES
279+ withNumberOfTouches: event.allTouches.count
280+ withPointerType: _pointerType];
281+
282+ [self sendActiveStateEventIfChangedForView: sender extraData: extraData];
283+ [self sendEventsInState: RNGestureHandlerStateEnd forViewWithTag: sender.reactTag withExtraData: extraData];
283284}
284285
285286- (void )handleDragExit : (UIView *)sender forEvent : (UIEvent *)event
Original file line number Diff line number Diff line change @@ -50,7 +50,8 @@ class InnerBaseButton extends React.Component<BaseButtonWithRefProps> {
5050 nativeEvent,
5151 } : HandlerStateChangeEvent < NativeViewGestureHandlerPayload > ) => {
5252 const { state, oldState, pointerInside } = nativeEvent ;
53- const active = pointerInside && state === State . ACTIVE ;
53+ const active =
54+ pointerInside && ( state === State . BEGAN || state === State . ACTIVE ) ;
5455
5556 if ( active !== this . lastActive && this . props . onActiveStateChange ) {
5657 this . props . onActiveStateChange ( active ) ;
Original file line number Diff line number Diff line change 11import * as React from 'react' ;
22import { Component } from 'react' ;
3- import { Animated , Platform } from 'react-native' ;
3+ import { Animated } from 'react-native' ;
44
55import type {
66 GestureEvent ,
@@ -174,10 +174,7 @@ export default class GenericTouchable extends Component<
174174 // Need to handle case with external cancellation (e.g. by ScrollView)
175175 this . moveToState ( TOUCHABLE_STATE . UNDETERMINED ) ;
176176 } else if (
177- // This platform check is an implication of slightly different behavior of handlers on different platform.
178- // And Android "Active" state is achieving on first move of a finger, not on press in.
179- // On iOS event on "Began" is not delivered.
180- state === ( Platform . OS !== 'android' ? State . ACTIVE : State . BEGAN ) &&
177+ state === State . BEGAN &&
181178 this . STATE === TOUCHABLE_STATE . UNDETERMINED
182179 ) {
183180 // Moving inside requires
Original file line number Diff line number Diff line change @@ -69,16 +69,16 @@ export const BaseButton = (props: BaseButtonProps) => {
6969 } ;
7070
7171 const onDeactivate = ( e : EndCallbackEventType ) => {
72+ props . onDeactivate ?.( e ) ;
73+ } ;
74+
75+ const onFinalize = ( e : EndCallbackEventType ) => {
7276 onActiveStateChange ?.( false ) ;
7377
7478 if ( ! e . canceled && ! longPressDetected . current ) {
7579 onPress ?.( e . pointerInside ) ;
7680 }
7781
78- props . onDeactivate ?.( e ) ;
79- } ;
80-
81- const onFinalize = ( e : EndCallbackEventType ) => {
8282 if ( longPressTimeout . current !== undefined ) {
8383 clearTimeout ( longPressTimeout . current ) ;
8484 longPressTimeout . current = undefined ;
You can’t perform that action at this time.
0 commit comments