ปัญหาหลักในการเปลี่ยนสีของสไตรค์ผ่านบรรทัดข้อความใน 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><Text style={{ textDecorationLine: 'line-through', textDecorationColor: 'red' }}>Hello world!</Text></code>
ตอบโต้ Native Strikethrough Text โดยใช้ StyleSheet
ใน React Native คุณสามารถใช้คุณสมบัติ styleSheet ขององค์ประกอบ Text เพื่อใช้สไตล์กับข้อความ
หากต้องการใช้คุณสมบัติ styleSheet คุณต้องสร้างวัตถุ StyleSheet ก่อน จากนั้น คุณสามารถใช้คุณสมบัติ styleSheet เพื่อนำสไตล์ไปใช้กับข้อความได้
นี่คือตัวอย่างวิธีใช้คุณสมบัติ styleSheet เพื่อใช้สไตล์กับข้อความใน React Native: