【问题标题】:How to make some part of text clickable and some part having different text color in react-native如何在 react-native 中使文本的某些部分可点击并且某些部分具有不同的文本颜色
【发布时间】:2017-09-22 11:04:33
【问题描述】:

我正在尝试制作不同颜色和可点击的文本部分

这是我的代码:

<Text style = {styles.term_service}>By signing up, you agree to Terms of Service and Privacy Policy.</Text>

我想让服务条款和隐私政策可点击并具有不同的颜色。

【问题讨论】:

    标签: android ios react-native


    【解决方案1】:

    您可以使用嵌套文本doc 也可以使用Text 接受onPress doc

    <Text style = {styles.term_service}>By signing up, you agree to Terms of Service and <Text onPress={()=> someAction()} style = {{ color: '#fff' }}>Privacy Policy.</Text></Text>
    

    【讨论】:

    • 被点击的内部文本对我不起作用:(
    猜你喜欢
    • 1970-01-01
    • 2011-09-26
    • 1970-01-01
    • 2021-09-06
    • 1970-01-01
    • 2020-03-17
    • 2012-11-17
    • 1970-01-01
    • 2011-09-03
    相关资源
    最近更新 更多