@expo/html-elements 0.12.2 → 0.12.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/build/css/createSafeStyledView.native.d.ts +1 -1
- package/build/css/createSafeStyledView.native.d.ts.map +1 -1
- package/build/elements/Anchor.d.ts +2 -2
- package/build/elements/Anchor.d.ts.map +1 -1
- package/build/elements/Headings.d.ts.map +1 -1
- package/build/elements/Layout.d.ts.map +1 -1
- package/build/elements/Lists.d.ts +2 -2
- package/build/elements/Lists.d.ts.map +1 -1
- package/build/elements/Rules.d.ts +2 -2
- package/build/elements/Rules.d.ts.map +1 -1
- package/build/elements/Rules.web.d.ts +1 -2
- package/build/elements/Rules.web.d.ts.map +1 -1
- package/build/elements/Table.d.ts +9 -9
- package/build/elements/Table.d.ts.map +1 -1
- package/build/elements/Table.web.d.ts.map +1 -1
- package/build/elements/Text.d.ts +15 -15
- package/build/elements/Text.d.ts.map +1 -1
- package/build/primitives/RNWView.d.ts +4 -2
- package/build/primitives/RNWView.d.ts.map +1 -1
- package/build/primitives/createDevView.d.ts +1 -1
- package/build/primitives/createDevView.d.ts.map +1 -1
- package/jest-setup.js +1 -0
- package/package.json +13 -7
- package/{build/Elements.js → src/Elements.tsx} +0 -1
- package/src/css/__tests__/__snapshots__/createSafeStyledView.test.native.tsx.snap.android +31 -0
- package/src/css/__tests__/__snapshots__/createSafeStyledView.test.native.tsx.snap.ios +31 -0
- package/src/css/__tests__/createSafeStyledView.test.native.tsx +54 -0
- package/src/css/createSafeStyledView.native.tsx +12 -0
- package/src/css/createSafeStyledView.tsx +4 -0
- package/src/css/filterStyles.ts +92 -0
- package/src/css/units.ts +11 -0
- package/src/elements/Anchor.tsx +27 -0
- package/src/elements/Headings.tsx +81 -0
- package/src/elements/Layout.tsx +72 -0
- package/src/elements/Lists.tsx +45 -0
- package/src/elements/Rules.tsx +18 -0
- package/src/elements/Rules.web.tsx +7 -0
- package/src/elements/Table.tsx +59 -0
- package/src/elements/Table.web.tsx +38 -0
- package/src/elements/Text.tsx +111 -0
- package/src/elements/Text.types.ts +21 -0
- package/src/elements/__tests__/Anchor.test.ios.tsx +10 -0
- package/src/elements/__tests__/Anchor.test.web.tsx +11 -0
- package/src/elements/__tests__/Headings.test.ios.tsx +13 -0
- package/src/elements/__tests__/Layout.test.ios.tsx +40 -0
- package/src/elements/__tests__/Layout.test.web.tsx +50 -0
- package/src/elements/__tests__/Lists.test.native.tsx +17 -0
- package/src/elements/__tests__/Lists.test.web.tsx +41 -0
- package/src/elements/__tests__/Rules.test.native.tsx +10 -0
- package/src/elements/__tests__/Rules.test.web.tsx +8 -0
- package/src/elements/__tests__/Table.test.ios.tsx +45 -0
- package/src/elements/__tests__/Table.test.web.tsx +49 -0
- package/src/elements/__tests__/Text.test.ios.tsx +102 -0
- package/src/elements/__tests__/__snapshots__/Anchor-test.tsx.snap.android +8 -0
- package/src/elements/__tests__/__snapshots__/Anchor-test.tsx.snap.ios +8 -0
- package/src/elements/__tests__/__snapshots__/Anchor-test.tsx.snap.web +12 -0
- package/src/elements/__tests__/__snapshots__/Anchor.test.ios.tsx.snap.ios +8 -0
- package/src/elements/__tests__/__snapshots__/Anchor.test.tsx.snap.android +8 -0
- package/src/elements/__tests__/__snapshots__/Anchor.test.tsx.snap.ios +8 -0
- package/src/elements/__tests__/__snapshots__/Anchor.test.tsx.snap.web +12 -0
- package/src/elements/__tests__/__snapshots__/Headings-test.tsx.snap.android +79 -0
- package/src/elements/__tests__/__snapshots__/Headings-test.tsx.snap.ios +79 -0
- package/src/elements/__tests__/__snapshots__/Headings-test.tsx.snap.web +61 -0
- package/src/elements/__tests__/__snapshots__/Headings.test.ios.tsx.snap.ios +79 -0
- package/src/elements/__tests__/__snapshots__/Layout-test.tsx.snap.android +23 -0
- package/src/elements/__tests__/__snapshots__/Layout-test.tsx.snap.ios +23 -0
- package/src/elements/__tests__/__snapshots__/Layout-test.tsx.snap.web +64 -0
- package/src/elements/__tests__/__snapshots__/Layout.test.ios.tsx.snap.ios +23 -0
- package/src/elements/__tests__/__snapshots__/Layout.test.tsx.snap.android +23 -0
- package/src/elements/__tests__/__snapshots__/Layout.test.tsx.snap.ios +23 -0
- package/src/elements/__tests__/__snapshots__/Layout.test.tsx.snap.web +64 -0
- package/src/elements/__tests__/__snapshots__/Lists-test.tsx.snap.android +14 -0
- package/src/elements/__tests__/__snapshots__/Lists-test.tsx.snap.ios +14 -0
- package/src/elements/__tests__/__snapshots__/Lists-test.tsx.snap.web +34 -0
- package/src/elements/__tests__/__snapshots__/Lists.test.native.tsx.snap.android +14 -0
- package/src/elements/__tests__/__snapshots__/Lists.test.native.tsx.snap.ios +14 -0
- package/src/elements/__tests__/__snapshots__/Rules-test.tsx.snap.android +15 -0
- package/src/elements/__tests__/__snapshots__/Rules-test.tsx.snap.ios +15 -0
- package/src/elements/__tests__/__snapshots__/Rules-test.tsx.snap.web +7 -0
- package/src/elements/__tests__/__snapshots__/Rules.test.native.tsx.snap.android +15 -0
- package/src/elements/__tests__/__snapshots__/Rules.test.native.tsx.snap.ios +15 -0
- package/src/elements/__tests__/__snapshots__/Table-test.tsx.snap.android +60 -0
- package/src/elements/__tests__/__snapshots__/Table-test.tsx.snap.ios +60 -0
- package/src/elements/__tests__/__snapshots__/Table-test.tsx.snap.web +71 -0
- package/src/elements/__tests__/__snapshots__/Table.test.ios.tsx.snap.ios +60 -0
- package/src/elements/__tests__/__snapshots__/Table.test.tsx.snap.android +60 -0
- package/src/elements/__tests__/__snapshots__/Table.test.tsx.snap.ios +60 -0
- package/src/elements/__tests__/__snapshots__/Table.test.tsx.snap.web +71 -0
- package/src/elements/__tests__/__snapshots__/Text-test.tsx.snap.android +174 -0
- package/src/elements/__tests__/__snapshots__/Text-test.tsx.snap.ios +174 -0
- package/src/elements/__tests__/__snapshots__/Text-test.tsx.snap.web +149 -0
- package/src/elements/__tests__/__snapshots__/Text.test.ios.tsx.snap.ios +174 -0
- package/src/primitives/Image.tsx +30 -0
- package/src/primitives/RNWView.tsx +178 -0
- package/src/primitives/Table.ts +14 -0
- package/src/primitives/Text.tsx +68 -0
- package/src/primitives/View.tsx +145 -0
- package/src/primitives/__tests__/__snapshots__/createDevView.test.ios.tsx.snap.ios +35 -0
- package/src/primitives/__tests__/__snapshots__/createDevView.test.tsx.snap.android +35 -0
- package/src/primitives/__tests__/__snapshots__/createDevView.test.tsx.snap.ios +35 -0
- package/src/primitives/__tests__/__snapshots__/createDevView.test.tsx.snap.web +30 -0
- package/src/primitives/__tests__/__snapshots__/createDevView.test.web.tsx.snap.web +27 -0
- package/src/primitives/__tests__/createDevView.test.tsx +53 -0
- package/src/primitives/createDevView.tsx +48 -0
- package/src/ts-declarations/process.d.ts +7 -0
- package/src/ts-declarations/react-native-web.d.ts +1016 -0
- package/tsconfig.json +2 -2
- package/build/Elements.js.map +0 -1
- package/build/css/createSafeStyledView.js +0 -5
- package/build/css/createSafeStyledView.js.map +0 -1
- package/build/css/createSafeStyledView.native.js +0 -10
- package/build/css/createSafeStyledView.native.js.map +0 -1
- package/build/css/filterStyles.js +0 -83
- package/build/css/filterStyles.js.map +0 -1
- package/build/css/units.js +0 -12
- package/build/css/units.js.map +0 -1
- package/build/elements/Anchor.js +0 -25
- package/build/elements/Anchor.js.map +0 -1
- package/build/elements/Headings.js +0 -78
- package/build/elements/Headings.js.map +0 -1
- package/build/elements/Layout.js +0 -46
- package/build/elements/Layout.js.map +0 -1
- package/build/elements/Lists.js +0 -33
- package/build/elements/Lists.js.map +0 -1
- package/build/elements/Rules.js +0 -16
- package/build/elements/Rules.js.map +0 -1
- package/build/elements/Rules.web.js +0 -6
- package/build/elements/Rules.web.js.map +0 -1
- package/build/elements/Table.js +0 -50
- package/build/elements/Table.js.map +0 -1
- package/build/elements/Table.web.js +0 -27
- package/build/elements/Table.web.js.map +0 -1
- package/build/elements/Text.js +0 -92
- package/build/elements/Text.js.map +0 -1
- package/build/elements/Text.types.js +0 -2
- package/build/elements/Text.types.js.map +0 -1
- package/build/primitives/Image.js +0 -5
- package/build/primitives/Image.js.map +0 -1
- package/build/primitives/RNWView.js +0 -122
- package/build/primitives/RNWView.js.map +0 -1
- package/build/primitives/Table.js +0 -3
- package/build/primitives/Table.js.map +0 -1
- package/build/primitives/Text.js +0 -5
- package/build/primitives/Text.js.map +0 -1
- package/build/primitives/View.js +0 -10
- package/build/primitives/View.js.map +0 -1
- package/build/primitives/createDevView.js +0 -43
- package/build/primitives/createDevView.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Image.js","sourceRoot":"","sources":["../../src/primitives/Image.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,WAAW,EAA6C,MAAM,cAAc,CAAC;AAG/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAuBnE,MAAM,KAAK,GAAG,WAAwC,CAAC;AAEvD,eAAe,oBAAoB,CAAC,KAAK,CAA8B,CAAC","sourcesContent":["import { ClassAttributes, ComponentProps, ComponentType } from 'react';\nimport { Image as NativeImage, ImageStyle as NativeImageStyle, StyleProp } from 'react-native';\n\nimport { WebViewStyle } from './View';\nimport { createSafeStyledView } from '../css/createSafeStyledView';\n\ntype NativeImageProps = ComponentProps<typeof NativeImage> & ClassAttributes<typeof NativeImage>;\n\nexport interface WebImageStyle {\n opacity?: number;\n}\n\nexport type ImageStyle = Omit<NativeImageStyle, 'position'> & WebImageStyle & WebViewStyle;\n\nexport type WebImageProps = {\n style?: StyleProp<ImageStyle>;\n /** @platform web */\n tabIndex?: number;\n /**\n * Set whether the image can be dragged with native browser behavior.\n * @platform web\n */\n draggable?: boolean;\n};\n\nexport type ImageProps = Omit<NativeImageProps, 'style'> & WebImageProps;\n\nconst Image = NativeImage as ComponentType<ImageProps>;\n\nexport default createSafeStyledView(Image) as ComponentType<ImageProps>;\n"]}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Expo.
|
|
3
|
-
* Copyright (c) Nicolas Gallagher.
|
|
4
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the MIT license found in the
|
|
7
|
-
* LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/
|
|
9
|
-
import * as React from 'react';
|
|
10
|
-
import StyleSheet from 'react-native-web/dist/exports/StyleSheet';
|
|
11
|
-
import TextAncestorContext from 'react-native-web/dist/exports/Text/TextAncestorContext';
|
|
12
|
-
import createElement from 'react-native-web/dist/exports/createElement';
|
|
13
|
-
import * as forwardedProps from 'react-native-web/dist/modules/forwardedProps';
|
|
14
|
-
import pick from 'react-native-web/dist/modules/pick';
|
|
15
|
-
import useElementLayout from 'react-native-web/dist/modules/useElementLayout';
|
|
16
|
-
import { useLocaleContext, getLocaleDirection } from 'react-native-web/dist/modules/useLocale';
|
|
17
|
-
import useMergeRefs from 'react-native-web/dist/modules/useMergeRefs';
|
|
18
|
-
import usePlatformMethods from 'react-native-web/dist/modules/usePlatformMethods';
|
|
19
|
-
import useResponderEvents from 'react-native-web/dist/modules/useResponderEvents';
|
|
20
|
-
const forwardPropsList = Object.assign({}, forwardedProps.defaultProps, forwardedProps.accessibilityProps, forwardedProps.clickProps, forwardedProps.defaultProps, forwardedProps.accessibilityProps, forwardedProps.clickProps, forwardedProps.focusProps, forwardedProps.keyboardProps, forwardedProps.mouseProps, forwardedProps.touchProps, forwardedProps.styleProps, {
|
|
21
|
-
href: true,
|
|
22
|
-
lang: true,
|
|
23
|
-
onScroll: true,
|
|
24
|
-
onWheel: true,
|
|
25
|
-
pointerEvents: true,
|
|
26
|
-
});
|
|
27
|
-
function pickProps(props) {
|
|
28
|
-
return pick(props, forwardPropsList);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* This is the View from react-native-web copied out in order to supply a custom `__element` property.
|
|
32
|
-
* In the past, you could use `createElement` to create an element with a custom HTML element, but this changed
|
|
33
|
-
* somewhere between 0.14...0.17.
|
|
34
|
-
*/
|
|
35
|
-
const View = React.forwardRef((props, forwardedRef) => {
|
|
36
|
-
const { __element, hrefAttrs, onLayout, onMoveShouldSetResponder, onMoveShouldSetResponderCapture, onResponderEnd, onResponderGrant, onResponderMove, onResponderReject, onResponderRelease, onResponderStart, onResponderTerminate, onResponderTerminationRequest, onScrollShouldSetResponder, onScrollShouldSetResponderCapture, onSelectionChangeShouldSetResponder, onSelectionChangeShouldSetResponderCapture, onStartShouldSetResponder, onStartShouldSetResponderCapture, ...rest } = props;
|
|
37
|
-
// if (process.env.NODE_ENV !== 'production') {
|
|
38
|
-
// React.Children.toArray(props.children).forEach((item) => {
|
|
39
|
-
// if (typeof item === 'string') {
|
|
40
|
-
// console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
|
|
41
|
-
// }
|
|
42
|
-
// });
|
|
43
|
-
// }
|
|
44
|
-
const hasTextAncestor = React.useContext(TextAncestorContext);
|
|
45
|
-
const hostRef = React.useRef(null);
|
|
46
|
-
const { direction: contextDirection } = useLocaleContext();
|
|
47
|
-
useElementLayout(hostRef, onLayout);
|
|
48
|
-
useResponderEvents(hostRef, {
|
|
49
|
-
onMoveShouldSetResponder,
|
|
50
|
-
onMoveShouldSetResponderCapture,
|
|
51
|
-
onResponderEnd,
|
|
52
|
-
onResponderGrant,
|
|
53
|
-
onResponderMove,
|
|
54
|
-
onResponderReject,
|
|
55
|
-
onResponderRelease,
|
|
56
|
-
onResponderStart,
|
|
57
|
-
onResponderTerminate,
|
|
58
|
-
onResponderTerminationRequest,
|
|
59
|
-
onScrollShouldSetResponder,
|
|
60
|
-
onScrollShouldSetResponderCapture,
|
|
61
|
-
onSelectionChangeShouldSetResponder,
|
|
62
|
-
onSelectionChangeShouldSetResponderCapture,
|
|
63
|
-
onStartShouldSetResponder,
|
|
64
|
-
onStartShouldSetResponderCapture,
|
|
65
|
-
});
|
|
66
|
-
let component = __element ?? 'div';
|
|
67
|
-
const langDirection = props.lang != null ? getLocaleDirection(props.lang) : null;
|
|
68
|
-
const componentDirection = props.dir || langDirection;
|
|
69
|
-
const writingDirection = componentDirection || contextDirection;
|
|
70
|
-
const supportedProps = pickProps(rest);
|
|
71
|
-
supportedProps.dir = componentDirection;
|
|
72
|
-
supportedProps.style = [styles.view$raw, hasTextAncestor && styles.inline, props.style];
|
|
73
|
-
// @ts-expect-error TODO(cedric): Property 'href' does not exist on type 'HTMLElement & PlatformMethods'
|
|
74
|
-
if (props.href != null) {
|
|
75
|
-
component = 'a';
|
|
76
|
-
if (hrefAttrs != null) {
|
|
77
|
-
const { download, rel, target } = hrefAttrs;
|
|
78
|
-
if (download != null) {
|
|
79
|
-
supportedProps.download = download;
|
|
80
|
-
}
|
|
81
|
-
if (rel != null) {
|
|
82
|
-
supportedProps.rel = rel;
|
|
83
|
-
}
|
|
84
|
-
if (typeof target === 'string') {
|
|
85
|
-
supportedProps.target = target.charAt(0) !== '_' ? '_' + target : target;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
const platformMethodsRef = usePlatformMethods(supportedProps);
|
|
90
|
-
const setRef = useMergeRefs(hostRef, platformMethodsRef, forwardedRef);
|
|
91
|
-
supportedProps.ref = setRef;
|
|
92
|
-
// @ts-expect-error TODO(cedric): 'writingDirection' does not exist in type 'ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...>'
|
|
93
|
-
return createElement(component, supportedProps, { writingDirection });
|
|
94
|
-
});
|
|
95
|
-
if (__DEV__) {
|
|
96
|
-
View.displayName = 'View';
|
|
97
|
-
}
|
|
98
|
-
const styles = StyleSheet.create({
|
|
99
|
-
view$raw: {
|
|
100
|
-
alignItems: 'stretch',
|
|
101
|
-
backgroundColor: 'transparent',
|
|
102
|
-
border: '0 solid black',
|
|
103
|
-
boxSizing: 'border-box',
|
|
104
|
-
display: 'flex',
|
|
105
|
-
flexBasis: 'auto',
|
|
106
|
-
flexDirection: 'column',
|
|
107
|
-
flexShrink: 0,
|
|
108
|
-
listStyle: 'none',
|
|
109
|
-
margin: 0,
|
|
110
|
-
minHeight: 0,
|
|
111
|
-
minWidth: 0,
|
|
112
|
-
padding: 0,
|
|
113
|
-
position: 'relative',
|
|
114
|
-
textDecoration: 'none',
|
|
115
|
-
zIndex: 0,
|
|
116
|
-
},
|
|
117
|
-
inline: {
|
|
118
|
-
display: 'inline-flex',
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
export default View;
|
|
122
|
-
//# sourceMappingURL=RNWView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RNWView.js","sourceRoot":"","sources":["../../src/primitives/RNWView.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,0CAA0C,CAAC;AAClE,OAAO,mBAAmB,MAAM,wDAAwD,CAAC;AAEzF,OAAO,aAAa,MAAM,6CAA6C,CAAC;AACxE,OAAO,KAAK,cAAc,MAAM,8CAA8C,CAAC;AAC/E,OAAO,IAAI,MAAM,oCAAoC,CAAC;AACtD,OAAO,gBAAgB,MAAM,gDAAgD,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAC/F,OAAO,YAAY,MAAM,4CAA4C,CAAC;AACtE,OAAO,kBAAkB,MAAM,kDAAkD,CAAC;AAClF,OAAO,kBAAkB,MAAM,kDAAkD,CAAC;AAGlF,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CACpC,EAAE,EACF,cAAc,CAAC,YAAY,EAC3B,cAAc,CAAC,kBAAkB,EACjC,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,YAAY,EAC3B,cAAc,CAAC,kBAAkB,EACjC,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,aAAa,EAC5B,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,UAAU,EACzB,cAAc,CAAC,UAAU,EACzB;IACE,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,IAAI;IACV,QAAQ,EAAE,IAAI;IACd,OAAO,EAAE,IAAI;IACb,aAAa,EAAE,IAAI;CACpB,CACF,CAAC;AAEF,SAAS,SAAS,CAAC,KAAgC;IACjD,OAAO,IAAI,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC;AACvC,CAAC;AAED;;;;GAIG;AAEH,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAA2C,CAAC,KAAK,EAAE,YAAY,EAAE,EAAE;IAC9F,MAAM,EACJ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,wBAAwB,EACxB,+BAA+B,EAC/B,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,6BAA6B,EAC7B,0BAA0B,EAC1B,iCAAiC,EACjC,mCAAmC,EACnC,0CAA0C,EAC1C,yBAAyB,EACzB,gCAAgC,EAChC,GAAG,IAAI,EACR,GAAG,KAAY,CAAC;IAEjB,+CAA+C;IAC/C,+DAA+D;IAC/D,sCAAsC;IACtC,oGAAoG;IACpG,QAAQ;IACR,QAAQ;IACR,IAAI;IAEJ,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAAC;IAE3D,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACpC,kBAAkB,CAAC,OAAO,EAAE;QAC1B,wBAAwB;QACxB,+BAA+B;QAC/B,cAAc;QACd,gBAAgB;QAChB,eAAe;QACf,iBAAiB;QACjB,kBAAkB;QAClB,gBAAgB;QAChB,oBAAoB;QACpB,6BAA6B;QAC7B,0BAA0B;QAC1B,iCAAiC;QACjC,mCAAmC;QACnC,0CAA0C;QAC1C,yBAAyB;QACzB,gCAAgC;KACjC,CAAC,CAAC;IAEH,IAAI,SAAS,GAAG,SAAS,IAAI,KAAK,CAAC;IAEnC,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACjF,MAAM,kBAAkB,GAAG,KAAK,CAAC,GAAG,IAAI,aAAa,CAAC;IACtD,MAAM,gBAAgB,GAAG,kBAAkB,IAAI,gBAAgB,CAAC;IAEhE,MAAM,cAAc,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACvC,cAAc,CAAC,GAAG,GAAG,kBAAkB,CAAC;IACxC,cAAc,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACxF,wGAAwG;IACxG,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;QACvB,SAAS,GAAG,GAAG,CAAC;QAChB,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;YACtB,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;YAC5C,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;gBACrB,cAAc,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACrC,CAAC;YACD,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;gBAChB,cAAc,CAAC,GAAG,GAAG,GAAG,CAAC;YAC3B,CAAC;YACD,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBAC/B,cAAc,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;YAC3E,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,kBAAkB,GAAG,kBAAkB,CAAC,cAAc,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,kBAAkB,EAAE,YAAY,CAAC,CAAC;IAEvE,cAAc,CAAC,GAAG,GAAG,MAAM,CAAC;IAE5B,2LAA2L;IAC3L,OAAO,aAAa,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,gBAAgB,EAAE,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC;AAEH,IAAI,OAAO,EAAE,CAAC;IACZ,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;AAC5B,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,QAAQ,EAAE;QACR,UAAU,EAAE,SAAS;QACrB,eAAe,EAAE,aAAa;QAC9B,MAAM,EAAE,eAAe;QACvB,SAAS,EAAE,YAAY;QACvB,OAAO,EAAE,MAAM;QACf,SAAS,EAAE,MAAM;QACjB,aAAa,EAAE,QAAQ;QACvB,UAAU,EAAE,CAAC;QACb,SAAS,EAAE,MAAM;QACjB,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,CAAC;QACZ,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,UAAU;QACpB,cAAc,EAAE,MAAM;QACtB,MAAM,EAAE,CAAC;KACV;IACD,MAAM,EAAE;QACN,OAAO,EAAE,aAAa;KACvB;CACF,CAAC,CAAC;AAEH,eAAe,IAAI,CAAC","sourcesContent":["/**\n * Copyright (c) Expo.\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport * as React from 'react';\nimport StyleSheet from 'react-native-web/dist/exports/StyleSheet';\nimport TextAncestorContext from 'react-native-web/dist/exports/Text/TextAncestorContext';\nimport { ViewProps } from 'react-native-web/dist/exports/View/types';\nimport createElement from 'react-native-web/dist/exports/createElement';\nimport * as forwardedProps from 'react-native-web/dist/modules/forwardedProps';\nimport pick from 'react-native-web/dist/modules/pick';\nimport useElementLayout from 'react-native-web/dist/modules/useElementLayout';\nimport { useLocaleContext, getLocaleDirection } from 'react-native-web/dist/modules/useLocale';\nimport useMergeRefs from 'react-native-web/dist/modules/useMergeRefs';\nimport usePlatformMethods from 'react-native-web/dist/modules/usePlatformMethods';\nimport useResponderEvents from 'react-native-web/dist/modules/useResponderEvents';\nimport { PlatformMethods } from 'react-native-web/dist/types';\n\nconst forwardPropsList = Object.assign(\n {},\n forwardedProps.defaultProps,\n forwardedProps.accessibilityProps,\n forwardedProps.clickProps,\n forwardedProps.defaultProps,\n forwardedProps.accessibilityProps,\n forwardedProps.clickProps,\n forwardedProps.focusProps,\n forwardedProps.keyboardProps,\n forwardedProps.mouseProps,\n forwardedProps.touchProps,\n forwardedProps.styleProps,\n {\n href: true,\n lang: true,\n onScroll: true,\n onWheel: true,\n pointerEvents: true,\n }\n);\n\nfunction pickProps(props: React.ComponentProps<any>) {\n return pick(props, forwardPropsList);\n}\n\n/**\n * This is the View from react-native-web copied out in order to supply a custom `__element` property.\n * In the past, you could use `createElement` to create an element with a custom HTML element, but this changed\n * somewhere between 0.14...0.17.\n */\n\nconst View = React.forwardRef<ViewProps, HTMLElement & PlatformMethods>((props, forwardedRef) => {\n const {\n __element,\n hrefAttrs,\n onLayout,\n onMoveShouldSetResponder,\n onMoveShouldSetResponderCapture,\n onResponderEnd,\n onResponderGrant,\n onResponderMove,\n onResponderReject,\n onResponderRelease,\n onResponderStart,\n onResponderTerminate,\n onResponderTerminationRequest,\n onScrollShouldSetResponder,\n onScrollShouldSetResponderCapture,\n onSelectionChangeShouldSetResponder,\n onSelectionChangeShouldSetResponderCapture,\n onStartShouldSetResponder,\n onStartShouldSetResponderCapture,\n ...rest\n } = props as any;\n\n // if (process.env.NODE_ENV !== 'production') {\n // React.Children.toArray(props.children).forEach((item) => {\n // if (typeof item === 'string') {\n // console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);\n // }\n // });\n // }\n\n const hasTextAncestor = React.useContext(TextAncestorContext);\n const hostRef = React.useRef(null);\n const { direction: contextDirection } = useLocaleContext();\n\n useElementLayout(hostRef, onLayout);\n useResponderEvents(hostRef, {\n onMoveShouldSetResponder,\n onMoveShouldSetResponderCapture,\n onResponderEnd,\n onResponderGrant,\n onResponderMove,\n onResponderReject,\n onResponderRelease,\n onResponderStart,\n onResponderTerminate,\n onResponderTerminationRequest,\n onScrollShouldSetResponder,\n onScrollShouldSetResponderCapture,\n onSelectionChangeShouldSetResponder,\n onSelectionChangeShouldSetResponderCapture,\n onStartShouldSetResponder,\n onStartShouldSetResponderCapture,\n });\n\n let component = __element ?? 'div';\n\n const langDirection = props.lang != null ? getLocaleDirection(props.lang) : null;\n const componentDirection = props.dir || langDirection;\n const writingDirection = componentDirection || contextDirection;\n\n const supportedProps = pickProps(rest);\n supportedProps.dir = componentDirection;\n supportedProps.style = [styles.view$raw, hasTextAncestor && styles.inline, props.style];\n // @ts-expect-error TODO(cedric): Property 'href' does not exist on type 'HTMLElement & PlatformMethods'\n if (props.href != null) {\n component = 'a';\n if (hrefAttrs != null) {\n const { download, rel, target } = hrefAttrs;\n if (download != null) {\n supportedProps.download = download;\n }\n if (rel != null) {\n supportedProps.rel = rel;\n }\n if (typeof target === 'string') {\n supportedProps.target = target.charAt(0) !== '_' ? '_' + target : target;\n }\n }\n }\n\n const platformMethodsRef = usePlatformMethods(supportedProps);\n const setRef = useMergeRefs(hostRef, platformMethodsRef, forwardedRef);\n\n supportedProps.ref = setRef;\n\n // @ts-expect-error TODO(cedric): 'writingDirection' does not exist in type 'ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...>'\n return createElement(component, supportedProps, { writingDirection });\n});\n\nif (__DEV__) {\n View.displayName = 'View';\n}\n\nconst styles = StyleSheet.create({\n view$raw: {\n alignItems: 'stretch',\n backgroundColor: 'transparent',\n border: '0 solid black',\n boxSizing: 'border-box',\n display: 'flex',\n flexBasis: 'auto',\n flexDirection: 'column',\n flexShrink: 0,\n listStyle: 'none',\n margin: 0,\n minHeight: 0,\n minWidth: 0,\n padding: 0,\n position: 'relative',\n textDecoration: 'none',\n zIndex: 0,\n },\n inline: {\n display: 'inline-flex',\n },\n});\n\nexport default View;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","sourceRoot":"","sources":["../../src/primitives/Table.ts"],"names":[],"mappings":"AAEA,OAAO,IAAI,MAAM,QAAQ,CAAC;AAW1B,MAAM,CAAC,MAAM,SAAS,GAAG,IAAqC,CAAC","sourcesContent":["import { ClassAttributes, ComponentProps, ComponentType } from 'react';\n\nimport Text from './Text';\n\ntype NativeTextProps = ComponentProps<typeof Text> & ClassAttributes<typeof Text>;\n\nexport type TableTextProps = NativeTextProps & {\n /** @platform web */\n colSpan?: number | string;\n /** @platform web */\n rowSpan?: number | string;\n};\n\nexport const TableText = Text as ComponentType<TableTextProps>;\n"]}
|
package/build/primitives/Text.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../../src/primitives/Text.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,IAAI,IAAI,UAAU,EAAgC,MAAM,cAAc,CAAC;AAG3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AA6DnE,MAAM,IAAI,GAAG,UAAsC,CAAC;AAEpD,eAAe,oBAAoB,CAAC,IAAI,CAA6B,CAAC","sourcesContent":["import { ClassAttributes, ComponentProps, ComponentType } from 'react';\nimport { StyleProp, Text as NativeText, TextStyle as NativeTextStyle } from 'react-native';\n\nimport { WebViewStyle } from './View';\nimport { createSafeStyledView } from '../css/createSafeStyledView';\n\n// https://github.com/necolas/react-native-web/issues/832\n\ntype NativeTextProps = ComponentProps<typeof NativeText> & ClassAttributes<typeof NativeText>;\n\nexport interface WebTextStyle {\n /** string is only available on web */\n fontSize?: NativeTextStyle['fontSize'] | string;\n /** string is only available on web */\n lineHeight?: NativeTextStyle['lineHeight'] | string;\n /** @platform web */\n fontFeatureSettings?: string;\n /** @platform web */\n textIndent?: string;\n /** @platform web */\n textOverflow?: string;\n /** @platform web */\n textRendering?: string;\n /** @platform web */\n textTransform?: string;\n /** @platform web */\n unicodeBidi?: string;\n /** @platform web */\n wordWrap?: string;\n}\n\nexport type TextStyle = Omit<NativeTextStyle, 'position' | 'fontSize' | 'lineHeight'> &\n WebTextStyle &\n WebViewStyle;\n\nexport type WebTextProps = {\n style?: StyleProp<TextStyle>;\n /** @platform web */\n tabIndex?: number;\n /** @platform web */\n 'aria-level'?: number;\n /**\n * @deprecated use `aria-level` instead.\n * @platform web\n */\n accessibilityLevel?: number;\n /** @platform web */\n href?: string;\n /** @deprecated use the prop `hrefAttrs={{ target: '...' }}` instead. */\n target?: string;\n /** @platform web */\n hrefAttrs?: {\n /** @platform web */\n target?: string;\n /** @platform web */\n rel?: string;\n /** @platform web */\n download?: boolean | string;\n };\n /** @platform web */\n lang?: string;\n};\n\nexport type TextProps = Omit<NativeTextProps, 'style'> & WebTextProps;\n\nconst Text = NativeText as ComponentType<TextProps>;\n\nexport default createSafeStyledView(Text) as ComponentType<TextProps>;\n"]}
|
package/build/primitives/View.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { View as NativeView, } from 'react-native';
|
|
2
|
-
import { createDevView } from './createDevView';
|
|
3
|
-
import { createSafeStyledView } from '../css/createSafeStyledView';
|
|
4
|
-
let View = NativeView;
|
|
5
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
6
|
-
// Add better errors and warnings in development builds.
|
|
7
|
-
View = createDevView(NativeView);
|
|
8
|
-
}
|
|
9
|
-
export default createSafeStyledView(View);
|
|
10
|
-
//# sourceMappingURL=View.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"View.js","sourceRoot":"","sources":["../../src/primitives/View.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,IAAI,IAAI,UAAU,GAKnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AA8HnE,IAAI,IAAI,GAAG,UAAsC,CAAC;AAElD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;IAC1C,wDAAwD;IACxD,IAAI,GAAG,aAAa,CAAC,UAAU,CAA6B,CAAC;AAC/D,CAAC;AAED,eAAe,oBAAoB,CAAC,IAAI,CAA6B,CAAC","sourcesContent":["import { ClassAttributes, ComponentProps, ComponentType } from 'react';\nimport {\n StyleProp,\n View as NativeView,\n ViewStyle as NativeViewStyle,\n BoxShadowValue,\n FilterFunction,\n type ColorValue,\n} from 'react-native';\n\nimport { createDevView } from './createDevView';\nimport { createSafeStyledView } from '../css/createSafeStyledView';\n\n// https://github.com/necolas/react-native-web/issues/832\n\ntype NativeViewProps = ComponentProps<typeof NativeView> & ClassAttributes<typeof NativeView>;\n\n/**\n * https://baconbrix.gitbook.io/react-native-web/primitives/view\n */\nexport interface WebViewStyle {\n /** @platform web */\n backdropFilter?: string;\n /** @platform web */\n animationDelay?: string;\n /** @platform web */\n animationDirection?: string;\n /** @platform web */\n animationDuration?: string;\n /** @platform web */\n animationFillMode?: string;\n /** @platform web */\n animationName?: string | any[];\n /** @platform web */\n animationIterationCount?: number | 'infinite';\n /** @platform web */\n animationPlayState?: string;\n /** @platform web */\n animationTimingFunction?: string;\n /** @platform web */\n backgroundAttachment?: string;\n /** @platform web */\n backgroundBlendMode?: string;\n /** @platform web */\n backgroundClip?: string;\n /** @platform web */\n backgroundImage?: string;\n /** @platform web */\n backgroundOrigin?: 'border-box' | 'content-box' | 'padding-box';\n /** @platform web */\n backgroundPosition?: string;\n /** @platform web */\n backgroundRepeat?: string;\n /** @platform web */\n backgroundSize?: string;\n /** @platform web */\n boxShadow?: string | readonly BoxShadowValue[];\n /** @platform web */\n boxSizing?: string;\n /** @platform web */\n clip?: string;\n /** @platform web */\n cursor?: string;\n /** @platform web */\n filter?: string | readonly FilterFunction[];\n /** @platform web */\n gridAutoColumns?: string;\n /** @platform web */\n gridAutoFlow?: string;\n /** @platform web */\n gridAutoRows?: string;\n /** @platform web */\n gridColumnEnd?: string;\n /** @platform web */\n gridColumnGap?: string;\n /** @platform web */\n gridColumnStart?: string;\n /** @platform web */\n gridRowEnd?: string;\n /** @platform web */\n gridRowGap?: string;\n /** @platform web */\n gridRowStart?: string;\n /** @platform web */\n gridTemplateColumns?: string;\n /** @platform web */\n gridTemplateRows?: string;\n /** @platform web */\n gridTemplateAreas?: string;\n /** @platform web */\n outline?: string;\n /** @platform web */\n outlineColor?: ColorValue;\n /** @platform web */\n overflowX?: string;\n /** @platform web */\n overflowY?: string;\n /** @platform web */\n overscrollBehavior?: 'auto' | 'contain' | 'none';\n /** @platform web */\n overscrollBehaviorX?: 'auto' | 'contain' | 'none';\n /** @platform web */\n overscrollBehaviorY?: 'auto' | 'contain' | 'none';\n /** @platform web */\n perspective?: string;\n /** @platform web */\n perspectiveOrigin?: string;\n /** @platform web */\n touchAction?: string;\n /** @platform web */\n transformOrigin?: string | (string | number)[];\n /** @platform web */\n transitionDelay?: string;\n /** @platform web */\n transitionDuration?: string;\n /** @platform web */\n transitionProperty?: string;\n /** @platform web */\n transitionTimingFunction?: string;\n /** @platform web */\n userSelect?: string;\n /** @platform web */\n visibility?: string;\n /** @platform web */\n willChange?: string;\n /** @platform web */\n position?: 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky';\n}\n\nexport type ViewStyle = Omit<NativeViewStyle, 'position'> & WebViewStyle;\n\nexport type WebViewProps = {\n style?: StyleProp<ViewStyle>;\n};\n\nexport type ViewProps = WebViewProps & Omit<NativeViewProps, 'style'>;\n\nlet View = NativeView as ComponentType<ViewProps>;\n\nif (process.env.NODE_ENV !== 'production') {\n // Add better errors and warnings in development builds.\n View = createDevView(NativeView) as ComponentType<ViewProps>;\n}\n\nexport default createSafeStyledView(View) as ComponentType<ViewProps>;\n"]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Platform, StyleSheet, Text } from 'react-native';
|
|
3
|
-
function useChildren(inputChildren) {
|
|
4
|
-
return React.useMemo(() => {
|
|
5
|
-
const children = [];
|
|
6
|
-
React.Children.forEach(inputChildren, (child) => {
|
|
7
|
-
if (child == null || typeof child === 'boolean') {
|
|
8
|
-
}
|
|
9
|
-
else if (typeof child === 'string' ||
|
|
10
|
-
typeof child === 'number' ||
|
|
11
|
-
typeof child === 'bigint') {
|
|
12
|
-
// Wrap text in a Text component.
|
|
13
|
-
let message = `Invalid raw text as a child of View: "${child}"${child === '' ? ` [empty string]` : ''}.`;
|
|
14
|
-
message += ' Wrap the text contents with a Text element or remove it.';
|
|
15
|
-
console.warn(message);
|
|
16
|
-
children.push(<Text style={[StyleSheet.absoluteFill, styles.error]}>
|
|
17
|
-
Unwrapped text: "<Text style={{ fontWeight: 'bold' }}>{child}</Text>"
|
|
18
|
-
</Text>);
|
|
19
|
-
}
|
|
20
|
-
else if ('type' in child && typeof child?.type === 'string' && Platform.OS !== 'web') {
|
|
21
|
-
// Disallow untransformed react-dom elements on native.
|
|
22
|
-
throw new Error(`Using unsupported React DOM element: <${child.type} />`);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
children.push(child);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
return children;
|
|
29
|
-
}, [inputChildren]);
|
|
30
|
-
}
|
|
31
|
-
/** Extend a view with a `children` filter that asserts more helpful warnings/errors. */
|
|
32
|
-
export function createDevView(View) {
|
|
33
|
-
return React.forwardRef(({ children, ...props }, forwardedRef) => {
|
|
34
|
-
return <View ref={forwardedRef} {...props} children={useChildren(children)}/>;
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
const styles = StyleSheet.create({
|
|
38
|
-
error: {
|
|
39
|
-
backgroundColor: 'firebrick',
|
|
40
|
-
color: 'white',
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
//# sourceMappingURL=createDevView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDevView.js","sourceRoot":"","sources":["../../src/primitives/createDevView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE1D,SAAS,WAAW,CAAC,aAA8B;IACjD,OAAO,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACxB,MAAM,QAAQ,GAAsB,EAAE,CAAC;QACvC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,EAAE;YAC9C,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YAClD,CAAC;iBAAM,IACL,OAAO,KAAK,KAAK,QAAQ;gBACzB,OAAO,KAAK,KAAK,QAAQ;gBACzB,OAAO,KAAK,KAAK,QAAQ,EACzB,CAAC;gBACD,iCAAiC;gBACjC,IAAI,OAAO,GAAG,yCAAyC,KAAK,IAC1D,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EACrC,GAAG,CAAC;gBACJ,OAAO,IAAI,2DAA2D,CAAC;gBACvE,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACtB,QAAQ,CAAC,IAAI,CACX,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CACnD;6BAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;UACtE,EAAE,IAAI,CAAC,CACR,CAAC;YACJ,CAAC;iBAAM,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,EAAE,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;gBACvF,uDAAuD;gBACvD,MAAM,IAAI,KAAK,CAAC,yCAAyC,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC;YAC5E,CAAC;iBAAM,CAAC;gBACN,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACvB,CAAC;QACH,CAAC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC;IAClB,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;AACtB,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,aAAa,CAAyC,IAAW;IAC/E,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAO,EAAE,YAA8B,EAAE,EAAE;QACtF,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,EAAG,CAAC;IACjF,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE;QACL,eAAe,EAAE,WAAW;QAC5B,KAAK,EAAE,OAAO;KACf;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Platform, StyleSheet, Text } from 'react-native';\n\nfunction useChildren(inputChildren: React.ReactNode) {\n return React.useMemo(() => {\n const children: React.ReactNode[] = [];\n React.Children.forEach(inputChildren, (child) => {\n if (child == null || typeof child === 'boolean') {\n } else if (\n typeof child === 'string' ||\n typeof child === 'number' ||\n typeof child === 'bigint'\n ) {\n // Wrap text in a Text component.\n let message = `Invalid raw text as a child of View: \"${child}\"${\n child === '' ? ` [empty string]` : ''\n }.`;\n message += ' Wrap the text contents with a Text element or remove it.';\n console.warn(message);\n children.push(\n <Text style={[StyleSheet.absoluteFill, styles.error]}>\n Unwrapped text: \"<Text style={{ fontWeight: 'bold' }}>{child}</Text>\"\n </Text>\n );\n } else if ('type' in child && typeof child?.type === 'string' && Platform.OS !== 'web') {\n // Disallow untransformed react-dom elements on native.\n throw new Error(`Using unsupported React DOM element: <${child.type} />`);\n } else {\n children.push(child);\n }\n });\n return children;\n }, [inputChildren]);\n}\n\n/** Extend a view with a `children` filter that asserts more helpful warnings/errors. */\nexport function createDevView<TView extends React.ComponentType<any>>(View: TView) {\n return React.forwardRef(({ children, ...props }: any, forwardedRef: React.Ref<TView>) => {\n return <View ref={forwardedRef} {...props} children={useChildren(children)} />;\n });\n}\n\nconst styles = StyleSheet.create({\n error: {\n backgroundColor: 'firebrick',\n color: 'white',\n },\n});\n"]}
|