-
Notifications
You must be signed in to change notification settings - Fork 1
/
FloatingActionButton.js
53 lines (49 loc) · 1.33 KB
/
FloatingActionButton.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
/**
* @flow
*/
import React from 'react';
import {
Image,
TouchableWithoutFeedback,
View,
} from 'react-native';
import StatelessComponent from './StatelessComponent';
type AssetId = number;
/**
* Custom-built FAB since none of the existing FABs seem to work the way I want.
*
* TODO: Consolidate with ExecuteButton.js
*/
type ExecuteButtonPropTypes = {
onPress: () => void,
source: AssetId,
style: any,
};
class FloatingActionButton extends StatelessComponent<ExecuteButtonPropTypes> {
render() {
const {onPress, source} = this.props;
return <TouchableWithoutFeedback onPress={onPress}>
<View style={{
width: 56,
height: 56,
backgroundColor: '#00AA00',
borderRadius: 28,
elevation: 6,
alignItems: 'center',
justifyContent: 'center',
...this.props.style,
}}>
<Image
source={source}
style={{
width: 24,
height: 24,
tintColor: 'white',
resizeMode: 'contain',
}}
/>
</View>
</TouchableWithoutFeedback>;
}
}
export default FloatingActionButton;