对具有触摸效果的单个文本中的多个文本反应本机内联样式 [英] React Native Inline style for multiple Text in single Text With Touch effect

查看:41
本文介绍了对具有触摸效果的单个文本中的多个文本反应本机内联样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以一些文本显示链接并显示如下输出.

I want to display link in some text and display output like following.

所以我完成了下面的代码.

So i was done following code.

<View style={{flexDirection: 'row', flexWrap: 'wrap'}}>
    <Text>This is non clockable text </Text>
    <TouchableOpacity><Text style={{fontWeight:'bold'}}>this is clickable text link for fire onPress</Text></TouchableOpacity>
    <Text> again</Text>
    <Text> non clickable text</Text>
</View>

但是它显示如下输出.

然后,在我使用以下代码之后,它可以满足我的输出要求,但是在单击时未设置突出显示效果.

then after i use following code so it fullfill my output requirement but on click highlight effect not set.

<Text>
    <Text>This is non clockable text </Text>
    <Text style={{fontWeight:'bold'}} onPress={()=>{alert('alert')}}>this is clickable text link for fire onPress</Text>
    <Text> again</Text>
    <Text> non clickable text</Text>
</Text>

如何通过触摸突出显示效果获得所需的输出?

how to get my desired output with touch highlight effect?

推荐答案

对我来说是有效的

<Text style={{ marginVertical: 20, }}>Your personal data will be used to process your order, support your experience
        throughout this app and other purposes describe in
        <Text style={{ color: 'blue' }}
              onPress={() => { /*your on press event here */ }}
            > privacy policy</Text>
        </Text>

这篇关于对具有触摸效果的单个文本中的多个文本反应本机内联样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆