Can you nest multiple native widgets in your styling, instead of separate constants?
0
Assume I have a container widget on my native app, that contains multiple containers, text widgets and perhaps other elements, some nested inside eachother. (for example in the image below). Right now, when I assign classes them to style them individually (or part of the collective component, for that matter), I have to define a separate constant for each object. That seems unnecessary tedious. Is it possible to define one single component in my React Native styling and, similar like 'container', 'text', 'caption' or 'view' as component properties, can we define each as part of the component? So instead of writing something like export const MyComponent = { (...) } export const MyComponentLeftColumn = { (...) } export const MyComponentTitle = { (...) } export const myComponentRightColumnIcon = { (...) } Would it be possible to write something like the following? export const MyComponent = { leftColumn: { backgroundColor: blue }, mainContainer: { width: "60%" }, mainTitle: { fontSize: 24, color: red } mainIconRight: { fontSize: 18, color: gray } } All with just the use of Mendix standard widgets, such as the container, text, layoutgrid and others.
asked
Sander Schaeffer
1 answers
0
Defining nested styling classes can be done in your JavaScript files, unfortunately you do have to export it as separate classes as you can't target nested elements. This is due to how React native handles the styling