我需要将Text组件中的选择文本链接到指向外部URL.我已经包含了一个TouchableOpacity并根据需要指定了宽度和高度,但是TouchableOpacity现在似乎与相邻文本重叠.例:
<Text>Lorem ipsum dolor sit amet, <TouchableOpacity onPress={() => {Linking.openURL('http://www.example.com/')}} style={{width: 108, height: 11}}><Text>consectetur adipiscing</Text></TouchableOpacity> elit. Fusce congue malesuada euismod.</Text>
TouchableOpacity在Text组件内部保持内联的最佳方法是什么?
Hen*_*k R 14
这样怎么样?
import { Text, Linking } from 'react-native';
<Text>Hey guys I wanted to share this awesome thing just press
<Text
style={{color: 'red'}}
onPress={() => {Linking.openURL('http://www.example.com/')}}
>
here
</Text>
to see it in your browser
</Text>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6149 次 |
| 最近记录: |