react-native-in-app-debugger 1.0.78 → 1.0.80

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.
package/Deeplink.tsx CHANGED
@@ -1,5 +1,13 @@
1
1
  import React, { useEffect } from "react";
2
- import { Linking, Text, TextInput, TouchableOpacity, View } from "react-native";
2
+ import {
3
+ Linking,
4
+ Text,
5
+ TextInput,
6
+ TouchableOpacity,
7
+ View,
8
+ FlatList,
9
+ } from "react-native";
10
+ import X from "./X";
3
11
 
4
12
  let LocalStorage;
5
13
  try {
@@ -14,14 +22,25 @@ export default ({ deeplinkPrefix, onClose }) => {
14
22
  const [history, setHistory] = React.useState([]);
15
23
 
16
24
  const go = (t) => {
17
- const newHistory = [t, ...history.filter((h) => h !== t)].slice(0, 3);
25
+ const newHistory = [t, ...history.filter((h) => h !== t)];
26
+ // setHistory(newHistory);
27
+ setTimeout(() => {
28
+ LocalStorage?.setItem(
29
+ "in-app-debugger-deeplink-list",
30
+ JSON.stringify(newHistory)
31
+ );
32
+ Linking.openURL(deeplinkPrefix + t);
33
+ }, 500);
34
+ onClose();
35
+ };
36
+
37
+ const remove = (t) => {
38
+ const newHistory = history.filter((h) => h !== t);
18
39
  setHistory(newHistory);
19
40
  LocalStorage?.setItem(
20
41
  "in-app-debugger-deeplink-list",
21
42
  JSON.stringify(newHistory)
22
43
  );
23
- onClose();
24
- Linking.openURL(deeplinkPrefix + t);
25
44
  };
26
45
 
27
46
  useEffect(() => {
@@ -56,11 +75,29 @@ export default ({ deeplinkPrefix, onClose }) => {
56
75
  <Text style={{ color: "black", fontSize: 9 }}>Go</Text>
57
76
  </TouchableOpacity>
58
77
  </View>
59
- {history.map((h) => (
60
- <TouchableOpacity style={{ margin: 6 }} onPress={() => go(h)}>
61
- <Text style={{ color: "grey", textAlign: "right" }}>{h}</Text>
62
- </TouchableOpacity>
63
- ))}
78
+ <FlatList
79
+ data={history}
80
+ renderItem={({ item }) => (
81
+ <View
82
+ style={{
83
+ flexDirection: "row",
84
+ alignItems: "center",
85
+ gap: 10,
86
+ padding: 10,
87
+ justifyContent: "flex-end",
88
+ }}
89
+ >
90
+ <TouchableOpacity onPress={() => go(item)}>
91
+ <Text style={{ color: "white", textAlign: "right" }}>{item}</Text>
92
+ </TouchableOpacity>
93
+ <X
94
+ style={{ marginRight: 5 }}
95
+ size={15}
96
+ onPress={() => remove(item)}
97
+ />
98
+ </View>
99
+ )}
100
+ />
64
101
  </View>
65
102
  );
66
103
  };
package/Libs.jsx CHANGED
@@ -9,7 +9,6 @@ import Text from "./Text";
9
9
  import Highlight from "./Highlight";
10
10
  import packageJson from "../../package.json";
11
11
  import realDeps from "./parentDependencies.js";
12
- import Deeplink from "./Deeplink";
13
12
 
14
13
  const libs = Object.entries(packageJson.dependencies).reduce(
15
14
  (arr, [name, version]) => [...arr, { name, version }],
@@ -21,7 +20,6 @@ export default (p) => {
21
20
 
22
21
  return (
23
22
  <>
24
- {!!p.deeplinkPrefix && <Deeplink {...p} />}
25
23
  <TextInput
26
24
  value={filter}
27
25
  placeholder="Filter..."
package/index.jsx CHANGED
@@ -6,7 +6,9 @@ import {
6
6
  View,
7
7
  SafeAreaView,
8
8
  useWindowDimensions,
9
+ FlatList,
9
10
  } from "react-native";
11
+ import Deeplink from "./Deeplink";
10
12
  import Text from "./Text";
11
13
  import X from "./X";
12
14
  const testId = "react-native-in-app-debugger-close-button";
@@ -64,6 +66,8 @@ export default ({
64
66
  interceptResponse,
65
67
  tabs = [],
66
68
  }) => {
69
+
70
+ const deeplinkPrefix = variables?.DEEPLINK_PREFIX;
67
71
  const [blacklists, setB, blacklistRef] = useStateRef([]);
68
72
  const dimension = useWindowDimensions();
69
73
 
@@ -189,11 +193,51 @@ export default ({
189
193
  ))}
190
194
  </View>
191
195
  <View style={{ flexDirection: "row", padding: 5, gap: 6 }}>
192
- <View style={{ flex: 1, flexDirection: "row" }}>
196
+ <FlatList
197
+ style={{flex: 1}}
198
+ data={[
199
+ "api",
200
+ !!variables && "vars",
201
+ !!deeplinkPrefix && "deeplink",
202
+ "libs",
203
+ ...tabs.map((t) => t.title),
204
+ ]
205
+ .filter(Boolean)}
206
+ keyExtractor={(item) => item}
207
+ horizontal
208
+ showsHorizontalScrollIndicator={false}
209
+ renderItem={({item, index})=>{
210
+ const isSelected = item === tab;
211
+ return (
212
+ <TouchableOpacity
213
+ onPress={() => setTab(item)}
214
+ activeOpacity={isSelected ? 1 : 0.7}
215
+ style={{
216
+ paddingHorizontal: 8,
217
+ borderBottomWidth: +isSelected,
218
+ borderColor: "white",
219
+ }}
220
+ >
221
+ <Text
222
+ style={{
223
+ color: "white",
224
+ opacity: isSelected ? 1 : 0.5,
225
+ textAlign: "center",
226
+ textTransform: "uppercase",
227
+ }}
228
+ >
229
+ {item}
230
+ {!index && !!apis.length && <Text> ({apis.length})</Text>}
231
+ </Text>
232
+ </TouchableOpacity>
233
+ );
234
+ }}
235
+ />
236
+ {/* <View style={{ flex: 1, flexDirection: "row" }}>
193
237
  {[
194
238
  "api",
195
239
  !!variables && "vars",
196
- "config",
240
+ "libs",
197
241
  ...tabs.map((t) => t.title),
198
242
  ]
199
243
  .filter(Boolean)
@@ -224,16 +268,12 @@ export default ({
224
268
  </TouchableOpacity>
225
269
  );
226
270
  })}
227
- </View>
271
+ </View> */}
228
272
  <X style={{ marginRight: 5 }} onPress={() => setIsOpen(false)} />
229
273
  </View>
230
- {tab === "vars" && !!variables && <Variables variables={variables} />}
231
- {tab === "config" && (
232
- <Libs
233
- deeplinkPrefix={variables.DEEPLINK_PREFIX}
234
- onClose={() => setIsOpen(false)}
235
- />
236
- )}
274
+ {tab === "vars" && <Variables variables={variables} />}
275
+ {tab === "deeplink" && <Deeplink deeplinkPrefix={deeplinkPrefix} onClose={() => setIsOpen(false)} />}
276
+ {tab === "libs" && <Libs />}
237
277
  {tab === "api" && (
238
278
  <Api
239
279
  {...{ apis, setBlacklists, blacklists, maxNumOfApiToStore }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-in-app-debugger",
3
- "version": "1.0.78",
3
+ "version": "1.0.80",
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
@@ -100,20 +100,22 @@ export default (defaultBadgeHeight) => {
100
100
  }, [defaultBadgeHeight]);
101
101
 
102
102
  useEffect(() => {
103
- setTimeout(() => setShouldShowDetails(isOpen), isOpen ? 200 : 0);
104
- Animated.spring(position, {
105
- toValue: isOpen ? { x: 0, y: 0 } : cachePosition.current,
106
- ...und,
107
- }).start();
108
- // Animated.spring(borderRadius, { toValue: isOpen ? 0 : defaultBorderRadius, ...und }).start();
109
- Animated.spring(badgeHeight, {
110
- toValue: isOpen ? height : defaultBadgeHeight,
111
- ...und,
112
- }).start();
113
- Animated.spring(badgeWidth, {
114
- toValue: isOpen ? width : defaultBadgeWidth,
115
- ...und,
116
- }).start();
103
+ setTimeout(() => setShouldShowDetails(isOpen), isOpen ? 500 : 0);
104
+ Animated.parallel([
105
+ Animated.spring(position, {
106
+ toValue: isOpen ? { x: 0, y: 0 } : cachePosition.current,
107
+ ...und,
108
+ }),
109
+ // Animated.spring(borderRadius, { toValue: isOpen ? 0 : defaultBorderRadius, ...und }),
110
+ Animated.spring(badgeHeight, {
111
+ toValue: isOpen ? height : defaultBadgeHeight,
112
+ ...und,
113
+ }),
114
+ Animated.spring(badgeWidth, {
115
+ toValue: isOpen ? width : defaultBadgeWidth,
116
+ ...und,
117
+ }),
118
+ ]).start();
117
119
  }, [isOpen]);
118
120
 
119
121
  return {