Skip to content

Commit fb8f054

Browse files
authored
Merge pull request #5 from itenl/dev-1.2.2
Added long press to copy
2 parents 0a41dd9 + e2cc2e7 commit fb8f054

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-vdebug",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "React-Native 调试工具",
55
"main": "index.js",
66
"scripts": {

src/log.js

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import { TextInput, FlatList, Text, StyleSheet, View, TouchableOpacity } from 'react-native';
2+
import { TextInput, FlatList, Text, StyleSheet, View, TouchableOpacity, Clipboard, TouchableWithoutFeedback, Alert } from 'react-native';
33
import event from './event';
44
import { debounce } from './tool';
55

@@ -169,20 +169,29 @@ class Log extends Component {
169169
if (this.state.filterLevel && this.state.filterLevel != item.method) return null;
170170
if (this.state.filterValue && this.regInstance && !this.regInstance.test(item.data)) return null;
171171
return (
172-
<View style={styles.logItem}>
173-
<View style={{ flexDirection: 'row' }}>
174-
<View style={{ flex: 0.8 }}>
175-
<Text style={styles.logItemTime}>{item.index}</Text>
176-
</View>
177-
<View style={{ flex: 0.8 }}>
178-
<Text style={styles.logItemTime}>{item.method}</Text>
179-
</View>
180-
<View style={{ flex: 2 }}>
181-
<Text style={styles.logItemTime}>{item.time}</Text>
172+
<TouchableWithoutFeedback
173+
onLongPress={() => {
174+
try {
175+
Clipboard.setString(`${item.data}\r\n\r\nLight up the little star and support me.\r\nhttps://github.com/itenl/react-native-vdebug`);
176+
Alert.alert('Info', 'Copy successfully', [{ text: 'OK' }]);
177+
} catch (error) {}
178+
}}
179+
>
180+
<View style={styles.logItem}>
181+
<View style={{ flexDirection: 'row' }}>
182+
<View style={{ flex: 0.8 }}>
183+
<Text style={styles.logItemTime}>{item.index}</Text>
184+
</View>
185+
<View style={{ flex: 0.8 }}>
186+
<Text style={styles.logItemTime}>{item.method}</Text>
187+
</View>
188+
<View style={{ flex: 2 }}>
189+
<Text style={styles.logItemTime}>{item.time}</Text>
190+
</View>
182191
</View>
192+
<Text style={[styles.logItemText, styles[item.method]]}>{item.data}</Text>
183193
</View>
184-
<Text style={[styles.logItemText, styles[item.method]]}>{item.data}</Text>
185-
</View>
194+
</TouchableWithoutFeedback>
186195
);
187196
}
188197

0 commit comments

Comments
 (0)