Skip to content

Commit

Permalink
fix unnecessary highlight when onPress or onLongPress props are not p…
Browse files Browse the repository at this point in the history
…rovided
  • Loading branch information
obipawan committed Apr 21, 2018
1 parent e6bcc4d commit 8693689
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Hyperlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,20 @@ class Hyperlink extends Component {
? this.props.linkText(url)
: this.props.linkText

const linkComponentProps = {}
if (OS !== 'web') {
linkComponentProps.onLongPress = () => this.props.onLongPress && this.props.onLongPress(url, text)
componentProps.onLongPress = this.props.onLongPress
? () => this.props.onLongPress(url, text)
: undefined
}
componentProps.onPress = this.props.onPress
? () => this.props.onPress(url, text)
: undefined

elements.push(
<Text
{ ...componentProps }
{ ...linkComponentProps }
key={ url + index }
style={ [ component.props.style, this.props.linkStyle ] }
onPress={ () => this.props.onPress && this.props.onPress(url, text) }
>
{ text }
</Text>
Expand Down

0 comments on commit 8693689

Please sign in to comment.