/
App.tsx
63 lines (55 loc) · 1.53 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
import * as React from 'react';
import { Dimensions, StyleSheet, View } from 'react-native';
import {
CubeTransitionView,
PageChangeProp,
TouchEventProp,
} from 'react-native-cube-transition';
const V2: React.FC = () => {
console.log('[App.V2.render]');
return <View style={{ ...styles.size, backgroundColor: 'yellow' }} />;
};
class V extends React.Component<any, any> {
render() {
console.log('[App.V.render]');
return <View style={{ ...styles.size, backgroundColor: 'green' }} />;
}
}
export default function App() {
const onTouch = (event: TouchEventProp) => {
console.log('[App.onTouch]', event.nativeEvent);
};
const onPageChange = (event: PageChangeProp) => {
console.log('[App.PageChangeProp]', event.nativeEvent);
};
return (
<View style={styles.container}>
<CubeTransitionView
style={styles.box}
onTouch={onTouch}
onPageChange={onPageChange}
>
<V />
<V2 />
<View style={{ ...styles.size, backgroundColor: 'black' }} />
<View style={{ ...styles.size, backgroundColor: 'orange' }} />
</CubeTransitionView>
</View>
);
}
const styles = StyleSheet.create({
container: {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
},
box: {
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
backgroundColor: 'purple',
},
size: {
position: 'absolute',
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
},
});