-
Notifications
You must be signed in to change notification settings - Fork 0
/
keyboards.js
83 lines (75 loc) · 2.05 KB
/
keyboards.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
import React, { Component } from "react";
import PropTypes from "prop-types";
import { Text, TouchableOpacity, ScrollView, StyleSheet } from "react-native";
import { KeyboardRegistry } from "react-native-keyboard-input";
class KeyboardView extends Component {
static propTypes = {
title: PropTypes.string
};
onButtonPress() {
KeyboardRegistry.onItemSelected("KeyboardView", {
message: "item selected from KeyboardView"
});
}
render() {
return (
<ScrollView
contentContainerStyle={[
styles.keyboardContainer,
{ backgroundColor: "purple" }
]}
>
<Text style={{ color: "white" }}>HELOOOO!!!</Text>
<Text style={{ color: "white" }}>{this.props.title}</Text>
<TouchableOpacity
testID={"click-me"}
style={{ padding: 20, marginTop: 30, backgroundColor: "white" }}
onPress={() => this.onButtonPress()}
>
<Text>Click Me!</Text>
</TouchableOpacity>
</ScrollView>
);
}
}
class AnotherKeyboardView extends Component {
static propTypes = {
title: PropTypes.string
};
onButtonPress() {
KeyboardRegistry.toggleExpandedKeyboard("AnotherKeyboardView");
}
render() {
return (
<ScrollView
contentContainerStyle={[
styles.keyboardContainer,
{ backgroundColor: "orange" }
]}
>
<Text>*** ANOTHER ONE ***</Text>
<Text>{this.props.title}</Text>
<TouchableOpacity
testID={"toggle-fs"}
style={{ padding: 20, marginTop: 30, backgroundColor: "white" }}
onPress={() => this.onButtonPress()}
>
<Text>Toggle Full-Screen!</Text>
</TouchableOpacity>
</ScrollView>
);
}
}
const styles = StyleSheet.create({
keyboardContainer: {
flex: 1,
flexDirection: "column",
alignItems: "center",
justifyContent: "center"
}
});
KeyboardRegistry.registerKeyboard("KeyboardView", () => KeyboardView);
KeyboardRegistry.registerKeyboard(
"AnotherKeyboardView",
() => AnotherKeyboardView
);