-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.js
55 lines (51 loc) · 1.14 KB
/
index.js
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from 'react';
import {
AppRegistry,
StyleSheet,
View,
VrButton,
NativeModules,
} from 'react-360';
import {EmojiText, registerKeyboard} from './react-360-keyboard';
type State = {|
name: ?string,
|};
export default class Keyboard360 extends React.Component<{||}, State> {
state = {
name: null,
};
onClick = () => {
NativeModules.Keyboard.startInput({
initialValue: this.state.name,
placeholder: 'Your name',
emoji: true,
}).then(name => {
console.log(name);
this.setState({name});
});
};
render() {
return (
<VrButton style={styles.greetingBox} onClick={this.onClick}>
<EmojiText style={styles.greeting}>
{this.state.name || 'Click to enter your name'}
</EmojiText>
</VrButton>
);
}
}
const styles = StyleSheet.create({
greetingBox: {
marginLeft: 350,
marginTop: 150,
padding: 20,
backgroundColor: '#000000',
borderColor: '#639dda',
borderWidth: 2,
},
greeting: {
fontSize: 30,
},
});
AppRegistry.registerComponent('Keyboard360', () => Keyboard360);
AppRegistry.registerComponent(...registerKeyboard);