In React you can clearly create an object and assign it as an inline style. i.e.. mentioned below.
var divStyle = {
Actually, there is a formal way to combine and it is like below:
But, there is a small issue, if one of them is passed by the parent component and it was created by a combined formal way we have a big problem:
// The passing style02 from props: [parentStyle01, parentStyle02]
// Now:
And this last line causes to have UI bug, surly, React Native cannot deal with a deep array inside an array. So I create my helper function:
import { StyleSheet } from 'react-native';
const styleJoiner = (...arg) => StyleSheet.flatten(arg);
By using my styleJoiner
anywhere you can combine any type of style and combine styles. even undefined
or other useless types don't cause to break the styling.