Refactors AppText and Segment components
This commit is contained in:
@@ -6,20 +6,11 @@ import Link from './link'
|
|||||||
|
|
||||||
import { Colors, Typography } from '../../styles/redesign'
|
import { Colors, Typography } from '../../styles/redesign'
|
||||||
|
|
||||||
export default function AppText({
|
const AppText = ({ children, linkStyle, style, ...props }) => {
|
||||||
children,
|
|
||||||
linkStyle,
|
|
||||||
onPress,
|
|
||||||
numberOfLines,
|
|
||||||
style
|
|
||||||
}) {
|
|
||||||
// we parse for links in case the text contains any
|
// we parse for links in case the text contains any
|
||||||
return (
|
return (
|
||||||
<Link style={linkStyle}>
|
<Link style={linkStyle}>
|
||||||
<Text style={[styles.text, style]}
|
<Text style={[styles.text, style]} {...props}>
|
||||||
onPress={onPress}
|
|
||||||
numberOfLines={numberOfLines}
|
|
||||||
>
|
|
||||||
{children}
|
{children}
|
||||||
</Text>
|
</Text>
|
||||||
</Link>
|
</Link>
|
||||||
@@ -29,8 +20,6 @@ export default function AppText({
|
|||||||
AppText.propTypes = {
|
AppText.propTypes = {
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
linkStyle: PropTypes.object,
|
linkStyle: PropTypes.object,
|
||||||
onPress: PropTypes.func,
|
|
||||||
numberOfLines: PropTypes.number,
|
|
||||||
style: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
style: PropTypes.oneOfType([PropTypes.array, PropTypes.object]),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,4 +28,6 @@ const styles = StyleSheet.create({
|
|||||||
color: Colors.greyDark,
|
color: Colors.greyDark,
|
||||||
...Typography.mainText
|
...Typography.mainText
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
export default AppText
|
||||||
@@ -20,6 +20,7 @@ const Segment = ({ children, last, title }) => {
|
|||||||
Segment.propTypes = {
|
Segment.propTypes = {
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
last: PropTypes.bool,
|
last: PropTypes.bool,
|
||||||
|
style: PropTypes.object,
|
||||||
title: PropTypes.string
|
title: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user