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

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.
Files changed (2) hide show
  1. package/Deeplink.tsx +61 -23
  2. package/package.json +1 -1
package/Deeplink.tsx CHANGED
@@ -1,28 +1,66 @@
1
- import React from 'react';
2
- import { Linking, Text, TextInput, TouchableOpacity, View } from 'react-native';
1
+ import React, { useEffect } from "react";
2
+ import { Linking, Text, TextInput, TouchableOpacity, View } from "react-native";
3
3
 
4
- export default ({deeplinkPrefix, onClose}) => {
5
- const [text, setText] = React.useState('');
4
+ let LocalStorage;
5
+ try {
6
+ LocalStorage =
7
+ require("@react-native-async-storage/async-storage/src").default;
8
+ } catch (error) {
9
+ // console.error("Error importing LocalStorage:", error);
10
+ }
11
+
12
+ export default ({ deeplinkPrefix, onClose }) => {
13
+ const [text, setText] = React.useState("");
14
+ const [history, setHistory] = React.useState([]);
15
+
16
+ const go = (t) => {
17
+ const newHistory = [t, ...history.filter((h) => h !== t)].slice(0, 3);
18
+ setHistory(newHistory);
19
+ LocalStorage?.setItem(
20
+ "in-app-debugger-deeplink-list",
21
+ JSON.stringify(newHistory)
22
+ );
23
+ onClose();
24
+ Linking.openURL(deeplinkPrefix + t);
25
+ };
26
+
27
+ useEffect(() => {
28
+ LocalStorage?.getItem("in-app-debugger-deeplink-list").then((d) => {
29
+ if (d) {
30
+ setHistory(JSON.parse(d));
31
+ }
32
+ });
33
+ }, []);
6
34
  return (
7
- <View style={{ flexDirection: 'row', alignItems: 'center', margin: 10 }}>
8
- <Text style={{ color: 'white' }}>{deeplinkPrefix}</Text>
9
- <TextInput
10
- value={text}
11
- autoCapitalize='none'
12
- autoCorrect={false}
13
- autoComplete='off'
14
- onChangeText={setText}
15
- style={{ flex: 1, backgroundColor: '#555', marginRight: 10, padding: 3, borderRadius: 3 }}
16
- />
17
- <TouchableOpacity
18
- style={{ padding: 7, borderRadius: 4, backgroundColor: 'white' }}
19
- onPress={() => {
20
- onClose();
21
- Linking.openURL(deeplinkPrefix + text);
22
- }}
23
- >
24
- <Text style={{ color: 'black', fontSize: 9 }}>Go</Text>
25
- </TouchableOpacity>
35
+ <View style={{ marginBottom: 10 }}>
36
+ <View style={{ flexDirection: "row", alignItems: "center", margin: 10 }}>
37
+ <Text style={{ color: "white" }}>{deeplinkPrefix}</Text>
38
+ <TextInput
39
+ value={text}
40
+ autoCapitalize="none"
41
+ autoCorrect={false}
42
+ autoComplete="off"
43
+ onChangeText={setText}
44
+ style={{
45
+ flex: 1,
46
+ backgroundColor: "#555",
47
+ marginRight: 10,
48
+ padding: 3,
49
+ borderRadius: 3,
50
+ }}
51
+ />
52
+ <TouchableOpacity
53
+ style={{ padding: 7, borderRadius: 4, backgroundColor: "white" }}
54
+ onPress={() => go(text)}
55
+ >
56
+ <Text style={{ color: "black", fontSize: 9 }}>Go</Text>
57
+ </TouchableOpacity>
58
+ </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
+ ))}
26
64
  </View>
27
65
  );
28
66
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-in-app-debugger",
3
- "version": "1.0.77",
3
+ "version": "1.0.78",
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": {