-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hyperlink on press doesn't work on Android 12 but long press work #64
Comments
asma-omar
changed the title
hyperlink on press doesn't work on Android 12
hyperlink on press doesn't work on Android 12 but long press work
Feb 13, 2022
Possible solution |
Works great, Thank you. |
Adding this to my
|
Looking at export default class extends Component {
constructor (props) {
super(props)
this.handleLink = this.handleLink.bind(this)
}
handleLink (url) {
const urlObject = mdurl.parse(url)
urlObject.protocol = urlObject.protocol.toLowerCase()
const normalizedURL = mdurl.format(urlObject)
Linking.canOpenURL(normalizedURL)
.then(supported => supported && Linking.openURL(normalizedURL))
}
render () {
const onPress = this.handleLink || this.props.onPress
if (this.props.linkDefault)
return <Hyperlink { ...this.props } onPress={ onPress }/>
return <Hyperlink { ...this.props } />
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
i'm using react native hyperlink to extract links from text and redirect to links on press using react native Linking.openUrl() it work fine on IOS & old android version but it seems that it is not pressed on Android version 12
this is my code
note that long press is work in all devices also android 12
<HyperLink linkDefault={true} onLongPress={url => { Linking.openURL(url) }} onPress={(url) => { Linking.openURL(url) }} >
@obipawan
The text was updated successfully, but these errors were encountered: