UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

1 lines • 1.85 kB
{"version":3,"file":"containerChildren.js","names":["RNText","RNScrollView"],"sources":["esm/platform/containerChildren.js"],"sourcesContent":["import { Children, createContext, Fragment, isValidElement } from \"react\";\nimport {\n Image,\n ScrollView as RNScrollView,\n Text as RNText,\n TextInput,\n View\n} from \"react-native-web\";\nconst InsideContainer = createContext(false);\nconst reactNativeChildren = new Set(\n [View, RNText, Image, RNScrollView, TextInput].filter(Boolean)\n);\nfunction assertOneNativeChildren(children, owner) {\n for (const child of Children.toArray(children)) {\n if (child === null || child === void 0 || typeof child === \"boolean\") continue;\n if (typeof child === \"string\" || typeof child === \"number\")\n throw new Error(`${owner} takes SwiftUI children, not raw text or numbers`);\n if (!isValidElement(child)) continue;\n if (child.type === Fragment) {\n assertOneNativeChildren(child.props.children, owner);\n continue;\n }\n if (typeof child.type === \"string\" || reactNativeChildren.has(child.type))\n throw new Error(\n `${owner} takes SwiftUI children; move React Native content into Swift.Slot`\n );\n }\n}\nexport {\n InsideContainer,\n assertOneNativeChildren\n};\n//# sourceMappingURL=containerChildren.js.map\n"],"mappings":";;;;AAQA,MAAM,kBAAkB,cAAc,KAAK;AAC3C,MAAM,sBAAsB,IAAI,IAC9B;CAAC;CAAMA;CAAQ;CAAOC;CAAc;AAAS,CAAC,CAAC,OAAO,OAAO,CAC/D;AACA,SAAS,wBAAwB,UAAU,OAAO;CAChD,KAAK,MAAM,SAAS,SAAS,QAAQ,QAAQ,GAAG;EAC9C,IAAI,UAAU,QAAQ,UAAU,KAAK,KAAK,OAAO,UAAU,WAAW;EACtE,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,UAChD,MAAM,IAAI,MAAM,GAAG,MAAM,iDAAiD;EAC5E,IAAI,CAAC,eAAe,KAAK,GAAG;EAC5B,IAAI,MAAM,SAAS,UAAU;GAC3B,wBAAwB,MAAM,MAAM,UAAU,KAAK;GACnD;EACF;EACA,IAAI,OAAO,MAAM,SAAS,YAAY,oBAAoB,IAAI,MAAM,IAAI,GACtE,MAAM,IAAI,MACR,GAAG,MAAM,mEACX;CACJ;AACF"}