罗广聪

发现 可复制

@@ -7,7 +7,8 @@ import { @@ -7,7 +7,8 @@ import {
7 Dimensions, 7 Dimensions,
8 ScrollView, 8 ScrollView,
9 Text, 9 Text,
10 - TouchableOpacity 10 + TouchableOpacity,
  11 + Clipboard,
11 } from "react-native"; 12 } from "react-native";
12 import { StackNavigator, TabNavigator } from "react-navigation"; 13 import { StackNavigator, TabNavigator } from "react-navigation";
13 14
@@ -54,6 +55,9 @@ export default class Discover extends Component { @@ -54,6 +55,9 @@ export default class Discover extends Component {
54 } 55 }
55 }); 56 });
56 } 57 }
  58 + copyWords(string) {
  59 + Clipboard.setString(string);
  60 + }
57 render() { 61 render() {
58 const { word, date } = this.state; 62 const { word, date } = this.state;
59 return ( 63 return (
@@ -71,7 +75,7 @@ export default class Discover extends Component { @@ -71,7 +75,7 @@ export default class Discover extends Component {
71 <View style={styles.wordConatier}> 75 <View style={styles.wordConatier}>
72 <Text style={styles.word}>{word}}</Text> 76 <Text style={styles.word}>{word}}</Text>
73 </View> 77 </View>
74 - <TouchableOpacity style={styles.button}> 78 + <TouchableOpacity style={styles.button} onPress={() => {this.copyWords(word)}}>
75 <Image style={styles.btnImg} source={require("../../assets/discover/ic_copy.png")} /> 79 <Image style={styles.btnImg} source={require("../../assets/discover/ic_copy.png")} />
76 <Text style={styles.btnText}>复制文案</Text> 80 <Text style={styles.btnText}>复制文案</Text>
77 </TouchableOpacity> 81 </TouchableOpacity>