React native 父子传递多种样式,哪种方式用的比较多?有什么不同?

React native passing multiple styles from parent to child, which method is more used? what is the difference?

React native 父子传多种样式,组件,哪种方式用的比较多?有什么区别?

其余参数类型, <文本样式={{...styles.title, ...props.style}}>{props.children}

我在这里也发现了这个语法:

使用数组, <文本样式={[styles.title, props.style]}>{props.children}

两个示例之间没有区别。但是,第二种方式是 react-native 文档中提到的组合样式的标准方式。

The style prop can be a plain old JavaScript object. That's what we usually use for example code. You can also pass an array of styles - the last style in the array has precedence, so you can use this to inherit styles.