-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
61 lines (57 loc) · 1.6 KB
/
App.js
File metadata and controls
61 lines (57 loc) · 1.6 KB
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
import React, {useState} from 'react';
import {
Button,
SafeAreaView,
View,
ScrollView,
Text,
StyleSheet,
} from 'react-native';
import {JavaExamples} from './JavaExamples';
import {JavaJSIExamples} from './JavaJSIExamples';
import {KotlinExamples} from './KotlinExamples';
import {KotlinJsiExamples} from './KotlinJsiExamples';
const SwitchButton = ({title, onPress}) => (
<View style={styles.switchButton}>
<Button title={title} onPress={onPress} />
</View>
);
const App = () => {
const [state, setState] = useState(JavaExamples.KEY);
return (
<SafeAreaView>
<ScrollView>
<Text>see console log for result</Text>
<View style={{flexDirection: 'row', width: '100%'}}>
<SwitchButton
title="Java"
onPress={() => setState(JavaExamples.KEY)}
/>
<SwitchButton
title="Java JSI"
onPress={() => setState(JavaJSIExamples.KEY)}
/>
<SwitchButton
title="Kotlin"
onPress={() => setState(KotlinExamples.KEY)}
/>
<SwitchButton
title="Kotlin JSI"
onPress={() => setState(KotlinJsiExamples.KEY)}
/>
</View>
{state === JavaExamples.KEY && <JavaExamples />}
{state === JavaJSIExamples.KEY && <JavaJSIExamples />}
{state === KotlinExamples.KEY && <KotlinExamples />}
{state === KotlinJsiExamples.KEY && <KotlinJsiExamples />}
</ScrollView>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
switchButton: {
flex: 1,
marginHorizontal: 8,
},
});
export default App;