react-native-in-app-debugger 2.0.0 → 2.0.2
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 +3 -1
- package/Mock/MockDetails.jsx +9 -9
- package/Mock/index.jsx +3 -1
- package/index.jsx +15 -4
- package/package.json +1 -1
- package/parentDependencies.js +0 -1
package/Api/index.jsx
CHANGED
|
@@ -182,7 +182,9 @@ export default (props) => {
|
|
|
182
182
|
: 0;
|
|
183
183
|
const isExpand = expands[item.id];
|
|
184
184
|
const bookmarkColor = props.bookmarks[item.id];
|
|
185
|
-
const color =
|
|
185
|
+
const color = item.isMocked
|
|
186
|
+
? "blue"
|
|
187
|
+
: hasResponse
|
|
186
188
|
? item.response.error
|
|
187
189
|
? "red"
|
|
188
190
|
: "white"
|
package/Mock/MockDetails.jsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { use, useEffect, useState } from 'react';
|
|
2
|
-
import { View, StyleSheet, TextInput, TouchableOpacity, Alert } from 'react-native';
|
|
2
|
+
import { FlatList, View, StyleSheet, TextInput, TouchableHighlight, TouchableOpacity, Alert } from 'react-native';
|
|
3
3
|
import Text from '../Text';
|
|
4
4
|
import X from '../X';
|
|
5
5
|
|
|
@@ -63,14 +63,14 @@ export default (p) => {
|
|
|
63
63
|
useEffect(reset, [p.mockDetails]);
|
|
64
64
|
const [canReset, setCanReset] = useState(false);
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
66
|
+
const parse = (data) => {
|
|
67
|
+
try {
|
|
68
|
+
return JSON.parse(data);
|
|
69
|
+
} catch (e) {
|
|
70
|
+
// Alert.alert('Error', 'Invalid JSON');
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
74
|
|
|
75
75
|
useEffect(() => {
|
|
76
76
|
try {
|
package/Mock/index.jsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import { FlatList, StyleSheet, TextInput } from 'react-native';
|
|
2
|
+
import { FlatList, StyleSheet, TextInput, TouchableHighlight, View } from 'react-native';
|
|
3
|
+
import Text from '../Text';
|
|
4
|
+
import Highlight from '../Highlight';
|
|
3
5
|
import MockGroup from './MockGroup';
|
|
4
6
|
|
|
5
7
|
const format = (m) => '(' + m.request.method + ') ' + m.request.url;
|
package/index.jsx
CHANGED
|
@@ -124,8 +124,9 @@ export default ({
|
|
|
124
124
|
|
|
125
125
|
const deleteMock = (id) => setMocks((v) => v.filter((i) => i.id !== id));
|
|
126
126
|
|
|
127
|
-
const
|
|
127
|
+
const numErrorApiCalls = apis.filter((a) => a.response?.error).length;
|
|
128
128
|
const numPendingApiCalls = apis.filter((a) => !a.response).length;
|
|
129
|
+
const numMockedApiCalls = apis.filter((a) => a.isMocked).length;
|
|
129
130
|
let badgeHeight = fontSize * 3;
|
|
130
131
|
|
|
131
132
|
const displayLabels = [
|
|
@@ -167,7 +168,8 @@ export default ({
|
|
|
167
168
|
height,
|
|
168
169
|
width,
|
|
169
170
|
zIndex: 999999999,
|
|
170
|
-
borderTopRightRadius:
|
|
171
|
+
borderTopRightRadius:
|
|
172
|
+
numPendingApiCalls || numErrorApiCalls ? 0 : undefined,
|
|
171
173
|
}}
|
|
172
174
|
{...(isOpen ? {} : panResponder.panHandlers)}
|
|
173
175
|
>
|
|
@@ -185,6 +187,13 @@ export default ({
|
|
|
185
187
|
activeOpacity={0.8}
|
|
186
188
|
>
|
|
187
189
|
<View style={styles.badgeContainer}>
|
|
190
|
+
{!!numMockedApiCalls && (
|
|
191
|
+
<View style={[styles.badge, { backgroundColor: "blue" }]}>
|
|
192
|
+
<Text style={{ fontSize, color: "white" }}>
|
|
193
|
+
{numMockedApiCalls}
|
|
194
|
+
</Text>
|
|
195
|
+
</View>
|
|
196
|
+
)}
|
|
188
197
|
{!!numPendingApiCalls && (
|
|
189
198
|
<View style={[styles.badge, { backgroundColor: "orange" }]}>
|
|
190
199
|
<Text style={{ fontSize, color: "white" }}>
|
|
@@ -192,9 +201,11 @@ export default ({
|
|
|
192
201
|
</Text>
|
|
193
202
|
</View>
|
|
194
203
|
)}
|
|
195
|
-
{!!
|
|
204
|
+
{!!numErrorApiCalls && (
|
|
196
205
|
<View style={[styles.badge, { backgroundColor: "red" }]}>
|
|
197
|
-
<Text style={{ fontSize, color: "white" }}>
|
|
206
|
+
<Text style={{ fontSize, color: "white" }}>
|
|
207
|
+
{numErrorApiCalls}
|
|
208
|
+
</Text>
|
|
198
209
|
</View>
|
|
199
210
|
)}
|
|
200
211
|
</View>
|
package/package.json
CHANGED
package/parentDependencies.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default {}
|