1.8 KiB
View
View is a flexbox container and the fundamental building block for UI. It is
designed to be nested inside other View's and to have 0-to-many children of
any type.
PropTypes
All other props are transferred directly to the element.
component:funcorstring(default"div")pointerEvents:oneOf('all', 'box-only', 'box-none', 'none')style:ViewStylePropTypes
ViewStylePropTypes
- BackgroundPropTypes
- BorderThemePropTypes
- LayoutPropTypes
boxShadow:stringcolor:stringopacity:number
ViewStyleDefaultProps
Implements the default styles from facebook/css-layout.
-
All the flex elements are oriented from top-to-bottom, left-to-right and do not shrink. This is how things are laid out using the default CSS settings and what you'd expect.
-
The most convenient way to express the relation between width and other box-model properties.
-
Everything is
display:flexby default. All the behaviors ofblockandinline-blockcan be expressed in term of flex but not the opposite. -
Everything is
position:relative. This makesposition:absolutetarget the direct parent and not some parent which is either relative or absolute. If you want to position an element relative to something else, you should move it in the DOM instead of relying of CSS. It also makestop,left,right,bottomdo something when not specifyingposition:absolute.
const ViewDefaultStyle = {
alignItems: 'stretch', // 1
borderWidth: 0,
borderStyle: 'solid',
boxSizing: 'border-box', // 2
display: 'flex', // 3
flexBasis: 'auto', // 1
flexDirection: 'column', // 1
flexShrink: 0, // 1
listStyle: 'none',
margin: 0,
padding: 0,
position: 'relative' // 4
};
Examples
// TODO