@@ -196,11 +196,14 @@ public PanGestureHandler create() {
196
196
@ Override
197
197
public void configure (PanGestureHandler handler , ReadableMap config ) {
198
198
super .configure (handler , config );
199
+ boolean hasCustomActivationCriteria = false ;
199
200
if (config .hasKey (KEY_PAN_MIN_DELTA_X )) {
200
201
handler .setMinDx (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MIN_DELTA_X )));
202
+ hasCustomActivationCriteria = true ;
201
203
}
202
204
if (config .hasKey (KEY_PAN_MIN_DELTA_Y )) {
203
205
handler .setMinDy (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MIN_DELTA_Y )));
206
+ hasCustomActivationCriteria = true ;
204
207
}
205
208
if (config .hasKey (KEY_PAN_MAX_DELTA_X )) {
206
209
handler .setMaxDx (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MAX_DELTA_X )));
@@ -210,24 +213,34 @@ public void configure(PanGestureHandler handler, ReadableMap config) {
210
213
}
211
214
if (config .hasKey (KEY_PAN_MIN_OFFSET_X )) {
212
215
handler .setMinOffsetX (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MIN_OFFSET_X )));
216
+ hasCustomActivationCriteria = true ;
213
217
}
214
218
if (config .hasKey (KEY_PAN_MIN_OFFSET_Y )) {
215
219
handler .setMinOffsetY (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MIN_OFFSET_Y )));
216
- }
217
- if (config .hasKey (KEY_PAN_MIN_DIST )) {
218
- handler .setMinDist (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MIN_DIST )));
220
+ hasCustomActivationCriteria = true ;
219
221
}
220
222
221
223
if (config .hasKey (KEY_PAN_MIN_VELOCITY )) {
222
224
// This value is actually in DPs/ms, but we can use the same function as for converting
223
225
// from DPs to pixels as the unit we're converting is in the numerator
224
226
handler .setMinVelocity (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MIN_VELOCITY )));
227
+ hasCustomActivationCriteria = true ;
225
228
}
226
229
if (config .hasKey (KEY_PAN_MIN_VELOCITY_X )) {
227
230
handler .setMinVelocityX (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MIN_VELOCITY_X )));
231
+ hasCustomActivationCriteria = true ;
228
232
}
229
233
if (config .hasKey (KEY_PAN_MIN_VELOCITY_Y )) {
230
234
handler .setMinVelocityY (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MIN_VELOCITY_Y )));
235
+ hasCustomActivationCriteria = true ;
236
+ }
237
+
238
+ // PanGestureHandler sets minDist by default, if there are custom criteria specified we want
239
+ // to reset that setting and use provided criteria instead.
240
+ if (config .hasKey (KEY_PAN_MIN_DIST )) {
241
+ handler .setMinDist (PixelUtil .toPixelFromDIP (config .getDouble (KEY_PAN_MIN_DIST )));
242
+ } else if (hasCustomActivationCriteria ) {
243
+ handler .setMinDist (Float .MAX_VALUE );
231
244
}
232
245
233
246
if (config .hasKey (KEY_PAN_MIN_POINTERS )) {
0 commit comments