Card.js.flow
1.17 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
/* @flow */
import * as React from 'react';
import { Animated, StyleSheet } from 'react-native';
import createPointerEventsContainer from './PointerEventsContainer';
import type { NavigationSceneRendererProps } from '../../TypeDefinition';
type Props = {
...$Exact<NavigationSceneRendererProps>,
children: React.ChildrenArray<*>,
onComponentRef: React.Ref<typeof Animated.View>,
pointerEvents: string,
style: any,
};
/**
* Component that renders the scene as card for the <NavigationCardStack />.
*/
class Card extends React.Component<Props> {
render() {
const { children, pointerEvents, style } = this.props;
return (
<Animated.View
pointerEvents={pointerEvents}
ref={this.props.onComponentRef}
style={[styles.main, style]}
>
{children}
</Animated.View>
);
}
}
const styles = StyleSheet.create({
main: {
backgroundColor: '#E9E9EF',
bottom: 0,
left: 0,
position: 'absolute',
right: 0,
shadowColor: 'black',
shadowOffset: { width: 0, height: 0 },
shadowOpacity: 0.2,
shadowRadius: 5,
top: 0,
},
});
Card = createPointerEventsContainer(Card);
export default Card;