首页 > 解决方案 > 如何向 React Native Paper Paragraph 添加超链接或邮件链接?

问题描述

如何添加到 react-native-paper<Paragraph></Paragraph>标签的链接?

标签: react-native-paper

解决方案


对于 Android,dataDetectorType 也适用于 RN Paper段落<Paragraph dataDetectorType="link">http://youraddress</Paragraph>或者<Paragraph dataDetectorType="email">mail address</Paragraph>

但是对于 iOS 和 Android 来说,实现这一点的最简单方法是使用Linking

import { Linking, } from } from 'react-native'; 

然后

<Paragraph 
    style={{ color: 'blue', textDecorationLine: 'underline', }} 
    onPress={() => Linking.openURL('mailto:address')}>
       mail
</Paragraph>

推荐阅读