蓝山帝景
它看起来像这样 https://snack.expo.io/@webspaceteam/juicy-cookieimport * as React from 'react';import { Text, View, StyleSheet, TouchableOpacity, Linking,} from 'react-native';import Constants from 'expo-constants';// You can import from local filesimport AssetExample from './components/AssetExample';// or any pure javascript modules available in npmimport { Card } from 'react-native-paper';export default function App() { const userText = 'rfrfop referoif frefio remfie https://snack.expo.io/@webspaceteam/ea041b fjir frfrfr'; const convert = () => { const urlRegex = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/; return userText.split(/\s+/).map((word) => { if (urlRegex.test(word)) { return ( <Text onPress={() => Linking.openURL(word)}> <Text style={{ color: 'blue' }}>{word}</Text>{' '} </Text> ); } else { return ( <> <Text>{word}</Text>{' '} </> ); } }); }; return ( <View style={styles.container}> <Text style={styles.paragraph}>{convert()}</Text> <Card> <AssetExample /> </Card> </View> );}const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', paddingTop: Constants.statusBarHeight, backgroundColor: '#ecf0f1', padding: 8, }, paragraph: {},});