-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
106 lines (100 loc) · 2.5 KB
/
App.tsx
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from "react";
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
TouchableOpacity,
} from "react-native";
import "react-native/tvos-types.d";
import { Colors } from "react-native/Libraries/NewAppScreen";
class App extends React.Component {
buttonRef1: TouchableOpacity;
buttonRef2: TouchableOpacity;
render() {
return (
<>
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}
>
<View style={styles.body}>
<View style={styles.container}>
<View style={styles.separator} />
<TouchableOpacity
ref={(ref) => (this.buttonRef1 = ref)}
onPress={() => this.buttonRef2.focus()}
style={styles.linkContainer}
>
<Text style={styles.link}>Button 1</Text>
<Text style={styles.description}>
Press to focus Button 2
</Text>
</TouchableOpacity>
</View>
<View style={styles.container}>
<View style={styles.separator} />
<TouchableOpacity
ref={(ref) => (this.buttonRef2 = ref)}
onPress={() => this.buttonRef1.focus()}
style={styles.linkContainer}
>
<Text style={styles.link}>Button 2</Text>
<Text style={styles.description}>
Press to focus Button 1
</Text>
</TouchableOpacity>
</View>
</View>
</ScrollView>
</SafeAreaView>
</>
);
}
}
const styles = StyleSheet.create({
scrollView: {
backgroundColor: Colors.lighter,
},
body: {
backgroundColor: Colors.white,
},
container: {
marginTop: 32,
paddingHorizontal: 24,
},
linkContainer: {
flexWrap: "wrap",
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
paddingVertical: 8,
},
link: {
flex: 2,
fontSize: 18,
fontWeight: "400",
color: Colors.primary,
},
description: {
flex: 3,
paddingVertical: 16,
fontWeight: "400",
fontSize: 18,
color: Colors.dark,
},
separator: {
backgroundColor: Colors.light,
height: 1,
},
});
export default App;