React Native-文本中的格式链接



我正在尝试格式化文本输入中存在的链接,就像堆栈溢出一样。单击时,链接应在浏览器中打开。

有人知道如何在React Native中做到这一点吗?

发现了与我所看到的类似的东西,它不会改变文本的样式,但可以点击中的链接。

https://github.com/AR-Studios-Group/Formated-Text-View

import React, { Component } from 'react';
import { View, StyleSheet, Button, Linking } from 'react-native';
export default class App extends Component {
render() {
return (
<View style={styles.container}>
<Button title="Click me" onPress={ ()=>{ Linking.openURL('https://google.com')}} />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#ecf0f1',
},
});

最新更新