1 3
import * as React from 'react';
2

3 3
export default function createNativeComponent(name: string) {
4 3
  return React.forwardRef((props, ref) => {
5 3
    const newProps: any = { ...props };
6 3
    newProps.__ref =
7
      typeof ref === 'function'
8 3
        ? ref
9 3
        : (e: any) => {
10 3
            if (ref) {
11 3
              (ref as React.MutableRefObject<any>).current = e;
12
            }
13
          };
14 3
    return React.createElement(name, newProps, props.children);
15
  });
16
}

Read our documentation on viewing source code .

Loading