Reputation: 167
I have this component
And i'm trying to apply background:
Someone know why background isn't appearing?
Upvotes: 0
Views: 75
Reputation: 524
Please change your BorderLayout
to below format.
return (
<View style={[styles.parent,props.style]}>
/* remaining code */
</View>
)
You don't need to use flatten as View takes an array of styles as input. By following approach, BorderLayout default styles can be overridden by using style prop.
Changes made:
moved props.style
to the end of the array so that it'll override default styles (in your case backgroundColor
).
Upvotes: 1
Reputation: 1646
In your BorderLayout
,
return(
<View style={props.style}>
//rest implementation
</View>
)
Please make sure that you have removed props.style
from StyleSheet.flatten(...)
Upvotes: 0