在具有触摸效果的单个文本中对多个文本反应本机内联样式

Bha*_*ani 7 text hyperlink reactjs react-native

我想在某些文本中显示链接并显示输出,如下所示。

在此输入图像描述

所以我按照代码完成了。

<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>
Run Code Online (Sandbox Code Playgroud)

但它显示如下输出。

在此输入图像描述

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

<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>
Run Code Online (Sandbox Code Playgroud)

如何通过触摸高亮效果获得我想要的输出?

Sul*_*Ali 5

对我来说它正在工作

<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>
Run Code Online (Sandbox Code Playgroud)


Vin*_*bhu 1

使用react-native-styled-text

这个库几乎处理所有事情