react-native-in-app-debugger 1.0.48 → 1.0.50
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/index.jsx +48 -35
- package/package.json +1 -1
package/index.jsx
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
Dimensions,
|
|
9
9
|
} from "react-native";
|
|
10
10
|
import Text from "./Text";
|
|
11
|
-
import X from
|
|
11
|
+
import X from "./X";
|
|
12
12
|
|
|
13
13
|
let DeviceInfo;
|
|
14
14
|
try {
|
|
@@ -19,7 +19,8 @@ try {
|
|
|
19
19
|
|
|
20
20
|
let LocalStorage;
|
|
21
21
|
try {
|
|
22
|
-
LocalStorage =
|
|
22
|
+
LocalStorage =
|
|
23
|
+
require("@react-native-async-storage/async-storage/src").default;
|
|
23
24
|
} catch (error) {
|
|
24
25
|
// console.error("Error importing LocalStorage:", error);
|
|
25
26
|
}
|
|
@@ -63,32 +64,40 @@ export default ({
|
|
|
63
64
|
}) => {
|
|
64
65
|
const [blacklists, setB, blacklistRef] = useStateRef([]);
|
|
65
66
|
|
|
66
|
-
const setBlacklists = d => {
|
|
67
|
+
const setBlacklists = (d) => {
|
|
67
68
|
if (!d) {
|
|
68
69
|
setB([]);
|
|
69
|
-
LocalStorage?.removeItem(
|
|
70
|
+
LocalStorage?.removeItem("in-app-debugger-blacklist");
|
|
70
71
|
} else {
|
|
71
|
-
setB(v => {
|
|
72
|
+
setB((v) => {
|
|
72
73
|
const newValue = Array.isArray(d) ? d : [...v, d];
|
|
73
|
-
LocalStorage?.setItem(
|
|
74
|
+
LocalStorage?.setItem(
|
|
75
|
+
"in-app-debugger-blacklist",
|
|
76
|
+
JSON.stringify(newValue)
|
|
77
|
+
);
|
|
74
78
|
return newValue;
|
|
75
79
|
});
|
|
76
80
|
}
|
|
77
|
-
}
|
|
81
|
+
};
|
|
78
82
|
|
|
79
83
|
if (LocalStorage) {
|
|
80
84
|
useEffect(() => {
|
|
81
85
|
setTimeout(() => {
|
|
82
|
-
LocalStorage.getItem(
|
|
86
|
+
LocalStorage.getItem("in-app-debugger-blacklist").then((d) => {
|
|
83
87
|
if (d) {
|
|
84
88
|
setBlacklists(JSON.parse(d));
|
|
85
89
|
}
|
|
86
90
|
});
|
|
87
91
|
}, 4000);
|
|
88
|
-
},[]);
|
|
92
|
+
}, []);
|
|
89
93
|
}
|
|
90
94
|
|
|
91
|
-
const { apis, ...restApiInterceptor } = useApiInterceptor(
|
|
95
|
+
const { apis, ...restApiInterceptor } = useApiInterceptor(
|
|
96
|
+
maxNumOfApiToStore,
|
|
97
|
+
blacklists,
|
|
98
|
+
interceptResponse,
|
|
99
|
+
blacklistRef
|
|
100
|
+
);
|
|
92
101
|
|
|
93
102
|
const [tab, setTab] = useState("api");
|
|
94
103
|
|
|
@@ -119,7 +128,7 @@ export default ({
|
|
|
119
128
|
shouldShowDetails,
|
|
120
129
|
} = useAnimation(badgeHeight);
|
|
121
130
|
|
|
122
|
-
const CustomTabComponent = tabs.find(t => tab === t.title)?.component;
|
|
131
|
+
const CustomTabComponent = tabs.find((t) => tab === t.title)?.component;
|
|
123
132
|
return (
|
|
124
133
|
<Animated.View
|
|
125
134
|
style={{
|
|
@@ -164,34 +173,38 @@ export default ({
|
|
|
164
173
|
<Label key={l}>{l}</Label>
|
|
165
174
|
))}
|
|
166
175
|
</View>
|
|
167
|
-
<View style={{ flexDirection: "row", padding: 5 }}>
|
|
176
|
+
<View style={{ flexDirection: "row", padding: 5, gap: 6 }}>
|
|
168
177
|
<View style={{ flex: 1, flexDirection: "row" }}>
|
|
169
178
|
{!!variables &&
|
|
170
|
-
["api", "variables", ...tabs.map(t => t.title)].map(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
flex: 1,
|
|
179
|
-
borderBottomWidth: +isSelected,
|
|
180
|
-
borderColor: "white",
|
|
181
|
-
}}
|
|
182
|
-
>
|
|
183
|
-
<Text
|
|
179
|
+
["api", "variables", ...tabs.map((t) => t.title)].map(
|
|
180
|
+
(t, i) => {
|
|
181
|
+
const isSelected = t === tab;
|
|
182
|
+
return (
|
|
183
|
+
<TouchableOpacity
|
|
184
|
+
onPress={() => setTab(t)}
|
|
185
|
+
activeOpacity={isSelected ? 1 : 0.7}
|
|
186
|
+
key={t}
|
|
184
187
|
style={{
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
flex: 1,
|
|
189
|
+
borderBottomWidth: +isSelected,
|
|
190
|
+
borderColor: "white",
|
|
188
191
|
}}
|
|
189
192
|
>
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
<Text
|
|
194
|
+
style={{
|
|
195
|
+
color: "white",
|
|
196
|
+
opacity: isSelected ? 1 : 0.5,
|
|
197
|
+
textAlign: "center",
|
|
198
|
+
textTransform: "uppercase",
|
|
199
|
+
}}
|
|
200
|
+
>
|
|
201
|
+
{t}
|
|
202
|
+
{!i && !!apis.length && <Text> ({apis.length})</Text>}
|
|
203
|
+
</Text>
|
|
204
|
+
</TouchableOpacity>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
)}
|
|
195
208
|
</View>
|
|
196
209
|
<X onPress={() => setIsOpen(false)} />
|
|
197
210
|
</View>
|
|
@@ -200,7 +213,7 @@ export default ({
|
|
|
200
213
|
)}
|
|
201
214
|
{tab === "api" && (
|
|
202
215
|
<Api
|
|
203
|
-
{...{apis, setBlacklists, blacklists, maxNumOfApiToStore}}
|
|
216
|
+
{...{ apis, setBlacklists, blacklists, maxNumOfApiToStore }}
|
|
204
217
|
{...restApiInterceptor}
|
|
205
218
|
/>
|
|
206
219
|
)}
|
package/package.json
CHANGED