נפתרה: שנה את צבע השביתה דרך שורת הטקסט ב-react native

הבעיה העיקרית בשינוי הצבע של סטרייק דרך שורת הטקסט ב-React Native היא שיכול להיות קשה להשיג את האפקט הרצוי.

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, אתה יכול להשתמש במאפיין styleSheet של רכיב טקסט כדי להחיל סגנונות על טקסט.

כדי להשתמש במאפיין styleSheet, תחילה עליך ליצור אובייקט StyleSheet. לאחר מכן, תוכל להשתמש במאפיין styleSheet כדי להחיל סגנונות על טקסט.

הנה דוגמה כיצד להשתמש במאפיין styleSheet כדי להחיל סגנונות על טקסט ב-React Native:

זה טקסט עם סגנונות

הודעות קשורות:

השאירו תגובה