Let's say I want to use a Component with below defined style:
var styles = StyleSheet.create({
container: {
backgroundColor: '#ffffff'
},
});
Can I override the base style with mine like this?
<Component style={backgroundColor: 'transparent'}></Component>
It didn't work for me, so wonder if this depends on if the Component supports the behavior.
To override style with React Native, we set the style prop to the styles we want by putting them in an object. const styles = StyleSheet. create({ CircleShapeView: { width: 50, height: 50, borderRadius: 50 / 2, backgroundColor: "#000", }, }); //...
To override a style, you have two options. Either you can pass a style object, or you can pass a function that will obtain props regarding the current internal state of the component, thus enabling you to modify styles dynamically depending on the component state, such as isError or isSelected .
With react-bootstrap , the table element can be overridden using the custom CSS classes, but before using the table, you need to import it. After importing the table element and bootstrap CSS, create the basic table.
If you want to override a component's styles using custom classes, you can use the className prop, available on each component.
The description is a bit vague. Is it a component you wrote your self? Assuming this it should work like this:
export default React.createClass({
render: function(){
return(<View style={[ styles.container, this.props.style ]}>...</View>
}
})
var styles = StyleSheet.create({
container: {
backgroundColor: '#ffffff'
},
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With