Rešeno: spremenite barvo prečrtane vrstice besedila v izvornem jeziku React

Glavna težava pri spreminjanju barve prečrtane vrstice besedila v React Native je, da je težko doseči želeni učinek.

I have a text component in React Native and I want to change the color of the strike through line. How can I do this?


A:

You can use the <code>textDecorationColor</code> style property: https://facebook.github.io/react-native/docs/text-style-props#textdecorationcolor
<code>&lt;Text style={{ textDecorationLine: 'line-through', textDecorationColor: 'red' }}&gt;Hello world!&lt;/Text&gt;</code>

Reagirajte izvorno prečrtano besedilo z uporabo slogovne tabele

V React Native lahko uporabite lastnost styleSheet komponente Text za uporabo slogov v besedilu.

Če želite uporabiti lastnost StyleSheet, morate najprej ustvariti predmet StyleSheet. Nato lahko uporabite lastnost styleSheet za uporabo slogov v besedilu.

Tukaj je primer, kako uporabiti lastnost styleSheet za uporabo slogov v besedilu v React Native:

To je nekaj besedila s slogi

Podobni objav:

Pustite komentar