I have a
component that is being passed a style so..
TextFile.js
:
This is a li
You aren't delegating the styles you pass to TextFile
to the actual Text
element in TextFile
. What you can do is add the styles together by passing an array of style objects to apply it:
This is a line of text and this might be a second line
From the React Native documentation:
You can also pass an array of styles - the last style in the array has precedence, so you can use this to inherit styles.
Thus, if you pass textAlign
in textWithContainer
, it'll be applied in the Text
component, and it can be reused as you wish without textAlign
.