forked from necolas/react-native-web
-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathindex.js
More file actions
40 lines (37 loc) · 967 Bytes
/
index.js
File metadata and controls
40 lines (37 loc) · 967 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Clipboard, StyleSheet, TextInput, View } from 'react-native';
import React from 'react';
import Button from '../../shared/button';
import Example from '../../shared/example';
export default function ClipboardPage() {
const setString = () => {
const success = Clipboard.setString(
'This text was copied to the clipboard by React Native'
);
console.log(`Clipboard.setString success? ${success}`);
};
return (
<Example title="Clipboard">
<View style={styles.buttonBox}>
<Button onPress={setString} title="Copy to clipboard" />
</View>
<TextInput
multiline={true}
placeholder={'Try pasting here afterwards'}
style={styles.textInput}
/>
</Example>
);
}
const styles = StyleSheet.create({
buttonBox: {
maxWidth: 300,
marginTop: '1rem'
},
textInput: {
borderColor: '#AAB8C2',
borderWidth: 1,
height: 50,
marginTop: 20,
padding: 5
}
});