UNPKG

1.93 kBSource Map (JSON)View Raw
1{"version":3,"sources":["utils.tsx"],"names":["childrenWithOverriddenStyle","children","Children","map","child","props","newProps","style","position","left","top","right","bottom","width","undefined","height","collapsable","React","cloneElement"],"mappings":";;;;;;;AAUA;;;;;;AAVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIO,MAAMA,2BAA2B,GAAIC,QAAD,IAA0B;AACnE;AACA;AACA;AACA,SAAOC,gBAASC,GAAT,CAAaF,QAAb,EAAwBG,KAAD,IAAW;AACvC,UAAM;AAAEC,MAAAA;AAAF,QAAYD,KAAlB;AACA,UAAME,QAAQ,GAAG,EACf,GAAGD,KADY;AAEfE,MAAAA,KAAK,EAAE,CACLF,KAAK,CAACE,KADD,EAEL;AACEC,QAAAA,QAAQ,EAAE,UADZ;AAEEC,QAAAA,IAAI,EAAE,CAFR;AAGEC,QAAAA,GAAG,EAAE,CAHP;AAIEC,QAAAA,KAAK,EAAE,CAJT;AAKEC,QAAAA,MAAM,EAAE,CALV;AAMEC,QAAAA,KAAK,EAAEC,SANT;AAOEC,QAAAA,MAAM,EAAED;AAPV,OAFK,CAFQ;AAcfE,MAAAA,WAAW,EAAE;AAdE,KAAjB;AAgBA,wBAAOC,eAAMC,YAAN,CAAmBd,KAAnB,EAA0CE,QAA1C,CAAP;AACD,GAnBM,CAAP;AAoBD,CAxBM","sourcesContent":["/**\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @format\n * @flow strict-local\n */\n\nimport React, { Children, ReactNode, ReactElement } from 'react';\n\nexport const childrenWithOverriddenStyle = (children?: ReactNode) => {\n // Override styles so that each page will fill the parent. Native component\n // will handle positioning of elements, so it's not important to offset\n // them correctly.\n return Children.map(children, (child) => {\n const { props } = child as ReactElement;\n const newProps = {\n ...props,\n style: [\n props.style,\n {\n position: 'absolute',\n left: 0,\n top: 0,\n right: 0,\n bottom: 0,\n width: undefined,\n height: undefined,\n },\n ],\n collapsable: false,\n };\n return React.cloneElement(child as ReactElement, newProps);\n });\n};\n"]}
\No newline at end of file