-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSegment.js
More file actions
28 lines (23 loc) · 714 Bytes
/
Copy pathSegment.js
File metadata and controls
28 lines (23 loc) · 714 Bytes
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
import React from 'react'
import PropTypes from 'prop-types'
import { Text, TouchableOpacity, ViewPropTypes } from 'react-native'
import styles from './styles'
/**
* A unit segment that is inside the segment control
*/
const Segment = ({ title, style, textStyle, onPress }) => (
<TouchableOpacity style={[styles.segment, styles.touchableSegment, style]} onPress={onPress}>
<Text style={[styles.defaultText, textStyle]}>{title}</Text>
</TouchableOpacity>
)
Segment.defaultProps = {
style: {},
textStyle: {}
}
Segment.propTypes = {
title: PropTypes.string.isRequired,
textStyle: Text.propTypes.style,
onPress: PropTypes.func.isRequired,
style: ViewPropTypes.style
}
export default Segment