UNPKG

919 BJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 *
9 */
10import React, { Children } from 'react';
11export const childrenWithOverriddenStyle = children => {
12 // Override styles so that each page will fill the parent. Native component
13 // will handle positioning of elements, so it's not important to offset
14 // them correctly.
15 return Children.map(children, child => {
16 const {
17 props
18 } = child;
19 const newProps = { ...props,
20 style: [props.style, {
21 position: 'absolute',
22 left: 0,
23 top: 0,
24 right: 0,
25 bottom: 0,
26 width: undefined,
27 height: undefined
28 }],
29 collapsable: false
30 };
31 return /*#__PURE__*/React.cloneElement(child, newProps);
32 });
33};
34//# sourceMappingURL=utils.js.map
\No newline at end of file