forked from FaridSafi/react-native-gifted-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAccessoryBar.js
46 lines (42 loc) · 1.13 KB
/
AccessoryBar.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
import { MaterialIcons } from '@expo/vector-icons'
import React from 'react'
import { StyleSheet, TouchableOpacity, View } from 'react-native'
import {
getLocationAsync,
pickImageAsync,
takePictureAsync,
} from './mediaUtils'
export default class AccessoryBar extends React.Component {
render() {
const { onSend } = this.props
return (
<View style={styles.container}>
<Button onPress={() => pickImageAsync(onSend)} name='photo' />
<Button onPress={() => takePictureAsync(onSend)} name='camera' />
<Button onPress={() => getLocationAsync(onSend)} name='my-location' />
</View>
)
}
}
const Button = ({
onPress,
size = 30,
color = 'rgba(0,0,0,0.5)',
...props
}) => (
<TouchableOpacity onPress={onPress}>
<MaterialIcons size={size} color={color} {...props} />
</TouchableOpacity>
)
const styles = StyleSheet.create({
container: {
height: 44,
width: '100%',
backgroundColor: 'white',
flexDirection: 'row',
justifyContent: 'space-around',
alignItems: 'center',
borderTopWidth: StyleSheet.hairlineWidth,
borderTopColor: 'rgba(0,0,0,0.3)',
},
})