Atrisināts: mainiet pārvilkšanas krāsu teksta rindiņā react native

Galvenā problēma, mainot svītru krāsu teksta rindiņā programmā React Native, ir tā, ka var būt grūti sasniegt vēlamo efektu.

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>

Reaģējiet uz vietējo pārsvītrotu tekstu, izmantojot stila lapu

Programmā React Native varat izmantot teksta komponenta rekvizītu styleSheet, lai tekstam lietotu stilus.

Lai izmantotu rekvizītu styleSheet, vispirms ir jāizveido StyleSheet objekts. Pēc tam varat izmantot rekvizītu styleSheet, lai tekstam lietotu stilus.

Tālāk ir sniegts piemērs, kā izmantot rekvizītu styleSheet, lai lietotu React Native tekstam stilus:

Šis ir teksts ar stiliem

Related posts:

Leave a Comment