Skip to content

Commit af25913

Browse files
arekkubaczkowskiArkadiusz Kubaczkowski
andauthored
fix(android): clone children instead of creating new ones (#284)
Co-authored-by: Arkadiusz Kubaczkowski <[email protected]>
1 parent cf88452 commit af25913

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/utils.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
* @flow strict-local
99
*/
1010

11-
import React, { Children, ReactElement, ReactNode } from 'react';
11+
import React, { Children, ReactNode, ReactElement } from 'react';
1212

1313
export const childrenWithOverriddenStyle = (children?: ReactNode) => {
1414
// Override styles so that each page will fill the parent. Native component
1515
// will handle positioning of elements, so it's not important to offset
1616
// them correctly.
1717
return Children.map(children, (child) => {
18-
const { props, type } = child as ReactElement;
18+
const { props } = child as ReactElement;
1919
const newProps = {
2020
...props,
2121
style: [
@@ -32,6 +32,6 @@ export const childrenWithOverriddenStyle = (children?: ReactNode) => {
3232
],
3333
collapsable: false,
3434
};
35-
return React.createElement(type, newProps);
35+
return React.cloneElement(child as ReactElement, newProps);
3636
});
3737
};

0 commit comments

Comments
 (0)