@@ -20,63 +20,277 @@ var ReactPropTypes = require('ReactPropTypes');
2020 *
2121 * The implementation in css-layout is slightly different from what the
2222 * Flexbox spec defines - for example, we chose more sensible default
23- * values. Please refer to the css-layout README for details.
23+ * values. Since our layout docs are generated from the comments in this
24+ * file, please keep a brief comment describing each prop type.
2425 *
2526 * These properties are a subset of our styles that are consumed by the layout
2627 * algorithm and affect the positioning and sizing of views.
2728 */
2829var LayoutPropTypes = {
30+ /** `width` sets the width of this component.
31+ *
32+ * It works similarly to `width` in CSS, but in React Native you
33+ * must use logical pixel units, rather than percents, ems, or any of that.
34+ * See http://www.w3schools.com/cssref/pr_dim_width.asp for more details.
35+ */
2936 width : ReactPropTypes . number ,
37+
38+ /** `height` sets the height of this component.
39+ *
40+ * It works similarly to `height` in CSS, but in React Native you
41+ * must use logical pixel units, rather than percents, ems, or any of that.
42+ * See http://www.w3schools.com/cssref/pr_dim_width.asp for more details.
43+ */
3044 height : ReactPropTypes . number ,
45+
46+ /** `top` is the number of logical pixels to offset the top edge of
47+ * this component.
48+ *
49+ * It works similarly to `top` in CSS, but in React Native you must
50+ * use logical pixel units, rather than percents, ems, or any of that.
51+ *
52+ * See https://developer.mozilla.org/en-US/docs/Web/CSS/top
53+ * for more details of how `top` affects layout.
54+ */
3155 top : ReactPropTypes . number ,
56+
57+ /** `left` is the number of logical pixels to offset the left edge of
58+ * this component.
59+ *
60+ * It works similarly to `left` in CSS, but in React Native you must
61+ * use logical pixel units, rather than percents, ems, or any of that.
62+ *
63+ * See https://developer.mozilla.org/en-US/docs/Web/CSS/left
64+ * for more details of how `left` affects layout.
65+ */
3266 left : ReactPropTypes . number ,
67+
68+ /** `right` is the number of logical pixels to offset the right edge of
69+ * this component.
70+ *
71+ * It works similarly to `right` in CSS, but in React Native you must
72+ * use logical pixel units, rather than percents, ems, or any of that.
73+ *
74+ * See https://developer.mozilla.org/en-US/docs/Web/CSS/right
75+ * for more details of how `right` affects layout.
76+ */
3377 right : ReactPropTypes . number ,
78+
79+ /** `bottom` is the number of logical pixels to offset the bottom edge of
80+ * this component.
81+ *
82+ * It works similarly to `bottom` in CSS, but in React Native you must
83+ * use logical pixel units, rather than percents, ems, or any of that.
84+ *
85+ * See https://developer.mozilla.org/en-US/docs/Web/CSS/bottom
86+ * for more details of how `top` affects layout.
87+ */
3488 bottom : ReactPropTypes . number ,
89+
90+ /** `minWidth` is the minimum width for this component, in logical pixels.
91+ *
92+ * It works similarly to `min-width` in CSS, but in React Native you
93+ * must use logical pixel units, rather than percents, ems, or any of that.
94+ *
95+ * See http://www.w3schools.com/cssref/pr_dim_min-width.asp
96+ * for more details.
97+ */
3598 minWidth : ReactPropTypes . number ,
99+
100+ /** `maxWidth` is the maximum width for this component, in logical pixels.
101+ *
102+ * It works similarly to `max-width` in CSS, but in React Native you
103+ * must use logical pixel units, rather than percents, ems, or any of that.
104+ *
105+ * See http://www.w3schools.com/cssref/pr_dim_max-width.asp
106+ * for more details.
107+ */
36108 maxWidth : ReactPropTypes . number ,
109+
110+ /** `minHeight` is the minimum height for this component, in logical pixels.
111+ *
112+ * It works similarly to `min-height` in CSS, but in React Native you
113+ * must use logical pixel units, rather than percents, ems, or any of that.
114+ *
115+ * See http://www.w3schools.com/cssref/pr_dim_min-height.asp
116+ * for more details.
117+ */
37118 minHeight : ReactPropTypes . number ,
119+
120+ /** `maxHeight` is the maximum height for this component, in logical pixels.
121+ *
122+ * It works similarly to `max-height` in CSS, but in React Native you
123+ * must use logical pixel units, rather than percents, ems, or any of that.
124+ *
125+ * See http://www.w3schools.com/cssref/pr_dim_max-height.asp
126+ * for more details.
127+ */
38128 maxHeight : ReactPropTypes . number ,
129+
130+ /** Setting `margin` has the same effect as setting each of
131+ * `marginTop`, `marginLeft`, `marginBottom`, and `marginRight`.
132+ */
39133 margin : ReactPropTypes . number ,
134+
135+ /** Setting `marginVertical` has the same effect as setting both
136+ * `marginTop` and `marginBottom`.
137+ */
40138 marginVertical : ReactPropTypes . number ,
139+
140+ /** Setting `marginHorizontal` has the same effect as setting
141+ * both `marginLeft` and `marginRight`.
142+ */
41143 marginHorizontal : ReactPropTypes . number ,
144+
145+ /** `marginTop` works like `margin-top` in CSS.
146+ * See http://www.w3schools.com/cssref/pr_margin-top.asp
147+ * for more details.
148+ */
42149 marginTop : ReactPropTypes . number ,
150+
151+ /** `marginBottom` works like `margin-bottom` in CSS.
152+ * See http://www.w3schools.com/cssref/pr_margin-bottom.asp
153+ * for more details.
154+ */
43155 marginBottom : ReactPropTypes . number ,
156+
157+ /** `marginLeft` works like `margin-left` in CSS.
158+ * See http://www.w3schools.com/cssref/pr_margin-left.asp
159+ * for more details.
160+ */
44161 marginLeft : ReactPropTypes . number ,
162+
163+ /** `marginRight` works like `margin-right` in CSS.
164+ * See http://www.w3schools.com/cssref/pr_margin-right.asp
165+ * for more details.
166+ */
45167 marginRight : ReactPropTypes . number ,
168+
169+ /** `padding` works like `padding` in CSS.
170+ * It's like setting each of `paddingTop`, `paddingBottom`,
171+ * `paddingLeft`, and `paddingRight` to the same thing.
172+ * See http://www.w3schools.com/css/css_padding.asp
173+ * for more details.
174+ */
46175 padding : ReactPropTypes . number ,
176+
177+ /** Setting `paddingVertical` is like setting both of
178+ * `paddingTop` and `paddingBottom`.
179+ */
47180 paddingVertical : ReactPropTypes . number ,
181+
182+ /** Setting `paddingHorizontal` is like setting both of
183+ * `paddingLeft` and `paddingRight`.
184+ */
48185 paddingHorizontal : ReactPropTypes . number ,
186+
187+ /** `paddingTop` works like `padding-top` in CSS.
188+ * See http://www.w3schools.com/cssref/pr_padding-top.asp
189+ * for more details.
190+ */
49191 paddingTop : ReactPropTypes . number ,
192+
193+ /** `paddingBottom` works like `padding-bottom` in CSS.
194+ * See http://www.w3schools.com/cssref/pr_padding-bottom.asp
195+ * for more details.
196+ */
50197 paddingBottom : ReactPropTypes . number ,
198+
199+ /** `paddingLeft` works like `padding-left` in CSS.
200+ * See http://www.w3schools.com/cssref/pr_padding-left.asp
201+ * for more details.
202+ */
51203 paddingLeft : ReactPropTypes . number ,
204+
205+ /** `paddingRight` works like `padding-right` in CSS.
206+ * See http://www.w3schools.com/cssref/pr_padding-right.asp
207+ * for more details.
208+ */
52209 paddingRight : ReactPropTypes . number ,
210+
211+ /** `borderWidth` works like `border-width` in CSS.
212+ * See http://www.w3schools.com/cssref/pr_border-width.asp
213+ * for more details.
214+ */
53215 borderWidth : ReactPropTypes . number ,
216+
217+ /** `borderTopWidth` works like `border-top-width` in CSS.
218+ * See http://www.w3schools.com/cssref/pr_border-top_width.asp
219+ * for more details.
220+ */
54221 borderTopWidth : ReactPropTypes . number ,
222+
223+ /** `borderRightWidth` works like `border-right-width` in CSS.
224+ * See http://www.w3schools.com/cssref/pr_border-right_width.asp
225+ * for more details.
226+ */
55227 borderRightWidth : ReactPropTypes . number ,
228+
229+ /** `borderBottomWidth` works like `border-bottom-width` in CSS.
230+ * See http://www.w3schools.com/cssref/pr_border-bottom_width.asp
231+ * for more details.
232+ */
56233 borderBottomWidth : ReactPropTypes . number ,
234+
235+ /** `borderLeftWidth` works like `border-left-width` in CSS.
236+ * See http://www.w3schools.com/cssref/pr_border-bottom_width.asp
237+ * for more details.
238+ */
57239 borderLeftWidth : ReactPropTypes . number ,
58240
241+ /** `position` in React Native is similar to regular CSS, but
242+ * everything is set to `relative` by default, so `absolute`
243+ * positioning is always just relative to the parent.
244+ *
245+ * If you want to position a child using specific numbers of logical
246+ * pixels relative to its parent, set the child to have `absolute`
247+ * position.
248+ *
249+ * If you want to position a child relative to something
250+ * that is not its parent, just don't use styles for that. Use the
251+ * component tree.
252+ *
253+ * See https://github.com/facebook/css-layout
254+ * for more details on how `position` differs between React Native
255+ * and CSS.
256+ */
59257 position : ReactPropTypes . oneOf ( [
60258 'absolute' ,
61259 'relative'
62260 ] ) ,
63261
64- // https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction
262+ /** `flexDirection` controls which directions children of a container go.
263+ * `row` goes left to right, `column` goes top to bottom, and you may
264+ * be able to guess what the other two do. It works like `flex-direction`
265+ * in CSS, except the default is `column`. See
266+ * https://css-tricks.com/almanac/properties/f/flex-direction/
267+ * for more detail.
268+ */
65269 flexDirection : ReactPropTypes . oneOf ( [
66270 'row' ,
67271 'row-reverse' ,
68272 'column' ,
69273 'column-reverse'
70274 ] ) ,
71275
72- // https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap
276+ /** `flexWrap` controls whether children can wrap around after they
277+ * hit the end of a flex container.
278+ * It works like `flex-wrap` in CSS. See
279+ * https://css-tricks.com/almanac/properties/f/flex-wrap/
280+ * for more detail.
281+ */
73282 flexWrap : ReactPropTypes . oneOf ( [
74283 'wrap' ,
75284 'nowrap'
76285 ] ) ,
77286
78- // How to align children in the main direction
79- // https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content
287+ /** `justifyContent` aligns children in the main direction.
288+ * For example, if children are flowing vertically, `justifyContent`
289+ * controls how they align vertically.
290+ * It works like `justify-content` in CSS. See
291+ * https://css-tricks.com/almanac/properties/j/justify-content/
292+ * for more detail.
293+ */
80294 justifyContent : ReactPropTypes . oneOf ( [
81295 'flex-start' ,
82296 'flex-end' ,
@@ -85,17 +299,27 @@ var LayoutPropTypes = {
85299 'space-around'
86300 ] ) ,
87301
88- // How to align children in the cross direction
89- // https://developer.mozilla.org/en-US/docs/Web/CSS/align-items
302+ /** `alignItems` aligns children in the cross direction.
303+ * For example, if children are flowing vertically, `alignItems`
304+ * controls how they align horizontally.
305+ * It works like `align-items` in CSS, except the default value
306+ * is `stretch` instead of `flex-start`. See
307+ * https://css-tricks.com/almanac/properties/a/align-items/
308+ * for more detail.
309+ */
90310 alignItems : ReactPropTypes . oneOf ( [
91311 'flex-start' ,
92312 'flex-end' ,
93313 'center' ,
94314 'stretch'
95315 ] ) ,
96316
97- // How to align the element in the cross direction
98- // https://developer.mozilla.org/en-US/docs/Web/CSS/align-items
317+ /** `alignSelf` controls how a child aligns in the cross direction,
318+ * overriding the `alignItems` of the parent. It works like `align-self`
319+ * in CSS. See
320+ * https://css-tricks.com/almanac/properties/a/align-self/
321+ * for more detail.
322+ */
99323 alignSelf : ReactPropTypes . oneOf ( [
100324 'auto' ,
101325 'flex-start' ,
@@ -104,10 +328,37 @@ var LayoutPropTypes = {
104328 'stretch'
105329 ] ) ,
106330
107- // https://developer.mozilla.org/en-US/docs/Web/CSS/flex
331+ /** In React Native `flex` does not work the same way that it does in CSS.
332+ * `flex` is a number rather than a string, and it works
333+ * according to the `css-layout` library
334+ * at https://github.com/facebook/css-layout .
335+ *
336+ * When `flex` is a positive number, it makes the component flexible
337+ * and it will be sized proportional to its flex value. So a
338+ * component with `flex` set to 2 will take twice the space as a
339+ * component with `flex` set to 1.
340+ *
341+ * When `flex` is 0, the component is sized according to `width`
342+ * and `height` and it is inflexible.
343+ *
344+ * When `flex` is -1, the component is normally sized according
345+ * `width` and `height`. However, if there's not enough space,
346+ * the component will shrink to its `minWidth` and `minHeight`.
347+ */
108348 flex : ReactPropTypes . number ,
109349
110- // https://developer.mozilla.org/en-US/docs/Web/CSS/z-index
350+ /** `zIndex` controls which components display on top of others.
351+ * Normally, you don't use `zIndex`. Components render according to
352+ * their order in the document tree, so later components draw over
353+ * earlier ones. `zIndex` may be useful if you have animations or custom
354+ * modal interfaces where you don't want this behavior.
355+ *
356+ * It works like the CSS `z-index` property - components with a larger
357+ * `zIndex` will render on top. Think of the z-direction like it's
358+ * pointing from the phone into your eyeball. See
359+ * https://developer.mozilla.org/en-US/docs/Web/CSS/z-index for
360+ * more detail.
361+ */
111362 zIndex : ReactPropTypes . number ,
112363} ;
113364
0 commit comments