Global “Text” color and “TextInput” text color

后端 未结 2 1039
生来不讨喜
生来不讨喜 2021-01-12 15:39

I\'ve started to work with react-native few days ago and after some extensive search I weren\'t able to find answers for 2 (simple?) questions:

  1. How can I ch

2条回答
  •  爱一瞬间的悲伤
    2021-01-12 16:08

    You have two options:

    1. Create your own Text component with the default styling you desire, and reuse it everywhere. (Like you mentioned)
    2. Create a StyleSheet object that is accessible globally and use it in every Text component.

    I think #1 is the best option. Despite the overhead of swapping all your out, it offers better flexibility in your project's future.

    There is no way to change all existing Text components unless you create a branch of the react-native library and modify the source code for Text. I do not recommend this method.

提交回复
热议问题