UNPKG

@shopify/react-native-skia

Version:

High-performance React Native Graphics using Skia

25 lines (24 loc) 847 B
import React, { useMemo, lazy, Suspense } from "react"; import { Platform } from "../Platform"; import { LoadSkiaWeb } from "./LoadSkiaWeb"; export const WithSkiaWeb = _ref => { let { getComponent, fallback, opts } = _ref; const Inner = useMemo( // TODO: investigate // eslint-disable-next-line @typescript-eslint/no-explicit-any () => /*#__PURE__*/lazy(async () => { if (Platform.OS === "web") { await LoadSkiaWeb(opts); } else { console.warn("<WithSkiaWeb /> is only necessary on web. Consider not using on native."); } return getComponent(); }), [getComponent, opts]); return /*#__PURE__*/React.createElement(Suspense, { fallback: fallback !== null && fallback !== void 0 ? fallback : null }, /*#__PURE__*/React.createElement(Inner, null)); }; //# sourceMappingURL=WithSkiaWeb.js.map