react-native-in-app-debugger 2.0.8 → 2.0.10
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/Api/index.jsx +22 -6
- package/Api/useApiInterceptor.js +18 -4
- package/Mock/MockDetails.jsx +9 -4
- package/package.json +1 -1
package/Api/index.jsx
CHANGED
|
@@ -285,16 +285,32 @@ export default (props) => {
|
|
|
285
285
|
<BlacklistIcon />
|
|
286
286
|
</TouchableOpacity>
|
|
287
287
|
)}
|
|
288
|
+
{isExpand && item.interface === "axios" && !!item.mockid && (
|
|
289
|
+
<TouchableOpacity
|
|
290
|
+
onPress={() => props.goToMock({ ...item, id: item.mockid })}
|
|
291
|
+
style={styles.actionButton}
|
|
292
|
+
>
|
|
293
|
+
<Text style={{ color: "black", fontSize: 10 }}>
|
|
294
|
+
Edit Mock
|
|
295
|
+
</Text>
|
|
296
|
+
</TouchableOpacity>
|
|
297
|
+
)}
|
|
288
298
|
{isExpand && item.interface === "axios" && (
|
|
289
299
|
<TouchableOpacity
|
|
290
|
-
onPress={() =>
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
300
|
+
onPress={() => props.goToMock(item)}
|
|
301
|
+
style={styles.actionButton}
|
|
302
|
+
>
|
|
303
|
+
<Text style={{ color: "black", fontSize: 10 }}>
|
|
304
|
+
{item.mockid ? "New " : ""}Mock
|
|
305
|
+
</Text>
|
|
306
|
+
</TouchableOpacity>
|
|
307
|
+
)}
|
|
308
|
+
{isExpand && (
|
|
309
|
+
<TouchableOpacity
|
|
310
|
+
onPress={() => props.deleteApi(item.id)}
|
|
295
311
|
style={styles.actionButton}
|
|
296
312
|
>
|
|
297
|
-
<Text style={{ color: "black", fontSize: 10 }}>
|
|
313
|
+
<Text style={{ color: "black", fontSize: 10 }}>Delete</Text>
|
|
298
314
|
</TouchableOpacity>
|
|
299
315
|
)}
|
|
300
316
|
</View>
|
package/Api/useApiInterceptor.js
CHANGED
|
@@ -50,11 +50,16 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
|
|
|
50
50
|
datetime: new Date().toLocaleString(),
|
|
51
51
|
time: `${hour}:${minute}:${second}`,
|
|
52
52
|
mockid: undefined,
|
|
53
|
-
interface: undefined
|
|
53
|
+
interface: undefined,
|
|
54
54
|
};
|
|
55
55
|
setApis((v) => {
|
|
56
56
|
const newData = [
|
|
57
|
-
{
|
|
57
|
+
{
|
|
58
|
+
request,
|
|
59
|
+
id: Date.now().toString(36) + Math.random().toString(36),
|
|
60
|
+
mockid: data.mockid,
|
|
61
|
+
interface: data.interface,
|
|
62
|
+
},
|
|
58
63
|
...(maxNumOfApiToStore ? v.slice(0, maxNumOfApiToStore - 1) : v),
|
|
59
64
|
];
|
|
60
65
|
return newData;
|
|
@@ -194,7 +199,7 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
|
|
|
194
199
|
if (!shouldExclude(url, method)) {
|
|
195
200
|
const data = config.data ? parse(config.data) : undefined;
|
|
196
201
|
|
|
197
|
-
|
|
202
|
+
const mock = mocked(url, method);
|
|
198
203
|
|
|
199
204
|
makeRequest({
|
|
200
205
|
url,
|
|
@@ -255,5 +260,14 @@ export default ({ maxNumOfApiToStore, blacklists, blacklistRef, mocks }) => {
|
|
|
255
260
|
);
|
|
256
261
|
}, [mocks]);
|
|
257
262
|
|
|
258
|
-
|
|
263
|
+
const deleteApi = (id) => {
|
|
264
|
+
setApis((v) => v.filter((a) => a.id !== id));
|
|
265
|
+
setBookmarks((v) => {
|
|
266
|
+
const newV = { ...v };
|
|
267
|
+
delete newV[id];
|
|
268
|
+
return newV;
|
|
269
|
+
});
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
return { apis, deleteApi, clear: () => setApis([]), bookmarks, setBookmarks };
|
|
259
273
|
};
|
package/Mock/MockDetails.jsx
CHANGED
|
@@ -168,11 +168,11 @@ export default (p) => {
|
|
|
168
168
|
})}
|
|
169
169
|
</View>
|
|
170
170
|
{tab === "response" && (
|
|
171
|
-
<View style={{ gap: 3 }}>
|
|
171
|
+
<View style={{ gap: 3, padding: 10 }}>
|
|
172
172
|
<View style={{ flexDirection: "row", gap: 5 }}>
|
|
173
173
|
<Text>Status</Text>
|
|
174
174
|
<TextInput
|
|
175
|
-
style={{
|
|
175
|
+
style={{ ...styles.textField, width: 50 }}
|
|
176
176
|
inputMode="numeric"
|
|
177
177
|
onChangeText={(t) => {
|
|
178
178
|
setTmpResStatus(t);
|
|
@@ -192,10 +192,9 @@ export default (p) => {
|
|
|
192
192
|
<Text>Body</Text>
|
|
193
193
|
<TextInput
|
|
194
194
|
style={{
|
|
195
|
-
|
|
195
|
+
...styles.textField,
|
|
196
196
|
height: 250,
|
|
197
197
|
flex: 1,
|
|
198
|
-
padding: 2,
|
|
199
198
|
}}
|
|
200
199
|
multiline
|
|
201
200
|
onChangeText={setTmpResBody}
|
|
@@ -276,4 +275,10 @@ const styles = StyleSheet.create({
|
|
|
276
275
|
alignItems: "center",
|
|
277
276
|
justifyContent: "center",
|
|
278
277
|
},
|
|
278
|
+
textField: {
|
|
279
|
+
backgroundColor: "#ccc",
|
|
280
|
+
width: 50,
|
|
281
|
+
padding: 2,
|
|
282
|
+
borderRadius: 5,
|
|
283
|
+
},
|
|
279
284
|
});
|
package/package.json
CHANGED