react-native-in-app-debugger 2.0.22 → 2.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/useAnimation.ts +30 -24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-in-app-debugger",
3
- "version": "2.0.22",
3
+ "version": "2.0.23",
4
4
  "description": "This library's main usage is to be used by Non-Technical testers during UAT, SIT or any testing phase.",
5
5
  "main": "index.jsx",
6
6
  "scripts": {
package/useAnimation.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef, useState } from "react";
1
+ import { useEffect, useMemo, useRef, useState } from "react";
2
2
  import {
3
3
  Animated,
4
4
  Keyboard,
@@ -69,29 +69,35 @@ export default (defaultBadgeHeight = 100) => {
69
69
  };
70
70
  }, [isOpen]);
71
71
 
72
- const panResponder = useRef(
73
- PanResponder.create({
74
- onStartShouldSetPanResponder: () => false,
75
- onMoveShouldSetPanResponder: (_, gestureState) => {
76
- const { dx, dy } = gestureState;
77
- return Math.abs(dx) > touchThreshold || Math.abs(dy) > touchThreshold;
78
- },
79
- onPanResponderGrant: () => {
80
- position.setOffset({ x: position.x._value, y: position.y._value });
81
- },
82
- onPanResponderMove: Animated.event(
83
- [null, { dx: position.x, dy: position.y }],
84
- und
85
- ),
86
- onPanResponderRelease: (_, g) => {
87
- position.flattenOffset();
88
- move({
89
- x: g.moveX > width / 2 ? width - defaultBadgeWidth : 0,
90
- y: Math.min(g.moveY, height - minimizedHeight),
91
- });
92
- },
93
- })
94
- ).current;
72
+ const panResponder = useMemo(
73
+ () =>
74
+ PanResponder.create({
75
+ onStartShouldSetPanResponder: () => false,
76
+ onMoveShouldSetPanResponder: (_: any, gestureState: any) => {
77
+ const { dx, dy } = gestureState;
78
+ return Math.abs(dx) > touchThreshold || Math.abs(dy) > touchThreshold;
79
+ },
80
+ onPanResponderGrant: () => {
81
+ position.setOffset({ x: position.x._value, y: position.y._value });
82
+ },
83
+ onPanResponderMove: Animated.event(
84
+ [null, { dx: position.x, dy: position.y }],
85
+ und
86
+ ),
87
+ onPanResponderRelease: (_, g) => {
88
+ position.flattenOffset();
89
+ move({
90
+ x: g.moveX > width / 2 ? width - defaultBadgeWidth : 0,
91
+ y: Math.min(g.moveY, height - minimizedHeight),
92
+ });
93
+ },
94
+ }),
95
+ [width]
96
+ );
97
+
98
+ useEffect(() => {
99
+ move({ x: 0, y: 100 });
100
+ }, [width]);
95
101
 
96
102
  useEffect(() => {
97
103
  setTimeout(() => setShouldShowDetails(isOpen), isOpen ? 500 : 0);