Diselesaikan: ubah warna coretan melalui baris teks dalam reaksi asli

Masalah utama dalam mengubah warna coretan melalui baris teks di React Native adalah sulitnya mencapai efek yang diinginkan.

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>

React Native Coret Text Menggunakan StyleSheet

Di React Native, Anda bisa menggunakan properti styleSheet dari komponen Text untuk menerapkan gaya ke teks.

Untuk menggunakan properti styleSheet, Anda harus terlebih dahulu membuat objek StyleSheet. Kemudian, Anda dapat menggunakan properti styleSheet untuk menerapkan gaya ke teks.

Berikut adalah contoh cara menggunakan properti styleSheet untuk menerapkan gaya ke teks di React Native:

Ini adalah beberapa teks dengan gaya

Pos terkait:

Tinggalkan Komentar