INNER CODE UNIT · TypeScript

cloneReactChildrenWithProps

maplibre/maplibre-react-native · package/src/utils/index.ts:82

export function cloneReactChildrenWithProps(
  children: ReactNode,
  propsToAdd: { [key: string]: string } = {},
): ReactElement[] | null {
  if (!children) {
    return null;
  }

  const foundChildren = Array.isArray(children) ? children : [children];
  const filteredChildren = foundChildren.filter((child) => !!child);

  return Children.map(filteredChildren, (child) =>
    cloneElement(child, propsToAdd),
  );
}

export function resolveImagePath(imageRef: ImageSourcePropType): string {
  const res = Image.resolveAssetSource(imageRef);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…