react-native-in-app-debugger 1.0.61 → 1.0.63
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/Row.jsx +58 -28
- package/Api/index.jsx +3 -2
- package/index.jsx +10 -0
- package/package.json +1 -1
- package/useAnimation.ts +1 -1
package/Api/Row.jsx
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import React, { useState } from
|
|
2
|
-
import { StyleSheet, TouchableOpacity, View } from
|
|
3
|
-
import Text from
|
|
4
|
-
import Highlight from
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import { ScrollView, StyleSheet, TouchableOpacity, View } from "react-native";
|
|
3
|
+
import Text from "../Text";
|
|
4
|
+
import Highlight from "../Highlight";
|
|
5
5
|
|
|
6
6
|
export const MAX_URL_LENGTH = 100;
|
|
7
7
|
|
|
8
|
-
export default ({ item, filter }) => {
|
|
8
|
+
export default ({ item, filter, wrap, setWrap }) => {
|
|
9
9
|
const tabs = [
|
|
10
|
-
{ value:
|
|
11
|
-
{ value:
|
|
12
|
-
{ value:
|
|
10
|
+
{ value: "Response Body" },
|
|
11
|
+
{ value: "Request Body", hide: !item.request.data },
|
|
12
|
+
{ value: "Request Header" },
|
|
13
13
|
];
|
|
14
14
|
const [tab, setTab] = useState(tabs[0].value);
|
|
15
15
|
const hasResponse = item.response;
|
|
@@ -20,12 +20,15 @@ export default ({ item, filter }) => {
|
|
|
20
20
|
<TouchableOpacity
|
|
21
21
|
activeOpacity={isSelected ? 1 : 0.7}
|
|
22
22
|
onPress={() => setTab(value)}
|
|
23
|
-
style={[
|
|
23
|
+
style={[
|
|
24
|
+
styles.selectionTab,
|
|
25
|
+
{ backgroundColor: isSelected ? "white" : undefined },
|
|
26
|
+
]}
|
|
24
27
|
>
|
|
25
28
|
<Text
|
|
26
29
|
style={{
|
|
27
|
-
color: isSelected ?
|
|
28
|
-
textAlign:
|
|
30
|
+
color: isSelected ? "#000" : "#ffffff88",
|
|
31
|
+
textAlign: "center",
|
|
29
32
|
}}
|
|
30
33
|
>
|
|
31
34
|
{value}
|
|
@@ -34,36 +37,63 @@ export default ({ item, filter }) => {
|
|
|
34
37
|
);
|
|
35
38
|
};
|
|
36
39
|
|
|
40
|
+
const Comp = wrap ? View : ScrollView;
|
|
41
|
+
|
|
37
42
|
return (
|
|
38
43
|
<View style={styles.container}>
|
|
39
44
|
{item.request.url.length > MAX_URL_LENGTH && (
|
|
40
|
-
<Text style={{ color:
|
|
45
|
+
<Text style={{ color: "#ffffff99", paddingVertical: 20 }}>
|
|
41
46
|
<Highlight text={item.request.url} filter={filter} />
|
|
42
47
|
</Text>
|
|
43
48
|
)}
|
|
44
|
-
<View>
|
|
45
|
-
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
<View style={{ flexDirection: "row" }}>
|
|
50
|
+
{tabs.map((t) => (
|
|
51
|
+
<Tab key={t.value} {...t} />
|
|
52
|
+
))}
|
|
53
|
+
</View>
|
|
54
|
+
<View style={{ flexDirection: "row", justifyContent: "flex-end" }}>
|
|
55
|
+
<TouchableOpacity
|
|
56
|
+
onPress={() => setWrap((v) => !v)}
|
|
57
|
+
style={{
|
|
58
|
+
borderWidth: 2,
|
|
59
|
+
backgroundColor: wrap ? "white" : undefined,
|
|
60
|
+
borderColor: "white",
|
|
61
|
+
padding: 5,
|
|
62
|
+
margin: 10,
|
|
63
|
+
borderRadius: 10,
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<Text style={{ color: wrap ? undefined : "white", fontSize: 10 }}>
|
|
67
|
+
Wrap Text
|
|
68
|
+
</Text>
|
|
69
|
+
</TouchableOpacity>
|
|
70
|
+
</View>
|
|
71
|
+
<Comp horizontal>
|
|
51
72
|
{tab === tabs[0].value && hasResponse && (
|
|
52
|
-
<Text style={{ color:
|
|
53
|
-
<Highlight
|
|
73
|
+
<Text style={{ color: "white" }}>
|
|
74
|
+
<Highlight
|
|
75
|
+
text={JSON.stringify(item.response.data, undefined, 4)}
|
|
76
|
+
filter={filter}
|
|
77
|
+
/>
|
|
54
78
|
</Text>
|
|
55
79
|
)}
|
|
56
80
|
{tab === tabs[1].value && (
|
|
57
|
-
<Text style={{ color:
|
|
58
|
-
<Highlight
|
|
81
|
+
<Text style={{ color: "white" }}>
|
|
82
|
+
<Highlight
|
|
83
|
+
text={JSON.stringify(item.request.data, undefined, 4)}
|
|
84
|
+
filter={filter}
|
|
85
|
+
/>
|
|
59
86
|
</Text>
|
|
60
87
|
)}
|
|
61
88
|
{tab === tabs[2].value && (
|
|
62
|
-
<Text style={{ color:
|
|
63
|
-
<Highlight
|
|
89
|
+
<Text style={{ color: "white" }}>
|
|
90
|
+
<Highlight
|
|
91
|
+
text={JSON.stringify(item.request.headers, undefined, 4)}
|
|
92
|
+
filter={filter}
|
|
93
|
+
/>
|
|
64
94
|
</Text>
|
|
65
95
|
)}
|
|
66
|
-
</
|
|
96
|
+
</Comp>
|
|
67
97
|
</View>
|
|
68
98
|
);
|
|
69
99
|
};
|
|
@@ -71,12 +101,12 @@ export default ({ item, filter }) => {
|
|
|
71
101
|
const styles = StyleSheet.create({
|
|
72
102
|
container: {
|
|
73
103
|
padding: 5,
|
|
74
|
-
backgroundColor:
|
|
104
|
+
backgroundColor: "#171717",
|
|
75
105
|
paddingTop: 10,
|
|
76
106
|
paddingBottom: 40,
|
|
77
107
|
},
|
|
78
108
|
selectionTab: {
|
|
79
|
-
borderBottomColor:
|
|
109
|
+
borderBottomColor: "white",
|
|
80
110
|
borderBottomWidth: 2,
|
|
81
111
|
flex: 1,
|
|
82
112
|
borderTopEndRadius: 10,
|
package/Api/index.jsx
CHANGED
|
@@ -41,6 +41,7 @@ export default (props) => {
|
|
|
41
41
|
const [filter, setFilter] = useState("");
|
|
42
42
|
const [errorOnly, setErrorOnly] = useState(false);
|
|
43
43
|
const [showBookmarkOnly, setShowBookmarkOnly] = useState(false);
|
|
44
|
+
const [wrap, setWrap] = useState(true);
|
|
44
45
|
const [expands, setExpands] = useState({});
|
|
45
46
|
const apis = props.apis.filter((a) => !errorOnly || isError(a));
|
|
46
47
|
|
|
@@ -158,7 +159,7 @@ export default (props) => {
|
|
|
158
159
|
.map((data) => ({ data: [data], id: data.id }))}
|
|
159
160
|
renderItem={(i) =>
|
|
160
161
|
expands[i.item.id] ? (
|
|
161
|
-
<Row {...i}
|
|
162
|
+
<Row {...i} {...{ wrap, setWrap, filter }} />
|
|
162
163
|
) : (
|
|
163
164
|
<View style={{ height: 20 }} />
|
|
164
165
|
)
|
|
@@ -231,7 +232,7 @@ export default (props) => {
|
|
|
231
232
|
Clipboard.setString(
|
|
232
233
|
JSON.stringify(content, undefined, 3)
|
|
233
234
|
);
|
|
234
|
-
Alert.alert(
|
|
235
|
+
Alert.alert("Copied");
|
|
235
236
|
}}
|
|
236
237
|
style={styles.actionButton}
|
|
237
238
|
>
|
package/index.jsx
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "react-native";
|
|
10
10
|
import Text from "./Text";
|
|
11
11
|
import X from "./X";
|
|
12
|
+
const testId = "react-native-in-app-debugger-close-button";
|
|
12
13
|
|
|
13
14
|
let DeviceInfo;
|
|
14
15
|
try {
|
|
@@ -131,6 +132,8 @@ export default ({
|
|
|
131
132
|
} = useAnimation(badgeHeight);
|
|
132
133
|
|
|
133
134
|
const CustomTabComponent = tabs.find((t) => tab === t.title)?.component;
|
|
135
|
+
const [disapear, setDisapear] = useState();
|
|
136
|
+
if (disapear) return null;
|
|
134
137
|
return (
|
|
135
138
|
<Animated.View
|
|
136
139
|
style={{
|
|
@@ -145,6 +148,13 @@ export default ({
|
|
|
145
148
|
}}
|
|
146
149
|
{...(isOpen ? {} : panResponder.panHandlers)}
|
|
147
150
|
>
|
|
151
|
+
<Text
|
|
152
|
+
accessibilityLabel={testId}
|
|
153
|
+
testId={testId}
|
|
154
|
+
accessible
|
|
155
|
+
onPress={() => setDisapear(true)}
|
|
156
|
+
style={{ height: 1 }}
|
|
157
|
+
/>
|
|
148
158
|
{!shouldShowDetails ? (
|
|
149
159
|
<TouchableOpacity
|
|
150
160
|
onPress={() => setIsOpen(true)}
|
package/package.json
CHANGED
package/useAnimation.ts
CHANGED