@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.
Files changed (149) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/build/css/createSafeStyledView.native.d.ts +1 -1
  3. package/build/css/createSafeStyledView.native.d.ts.map +1 -1
  4. package/build/elements/Anchor.d.ts +2 -2
  5. package/build/elements/Anchor.d.ts.map +1 -1
  6. package/build/elements/Headings.d.ts.map +1 -1
  7. package/build/elements/Layout.d.ts.map +1 -1
  8. package/build/elements/Lists.d.ts +2 -2
  9. package/build/elements/Lists.d.ts.map +1 -1
  10. package/build/elements/Rules.d.ts +2 -2
  11. package/build/elements/Rules.d.ts.map +1 -1
  12. package/build/elements/Rules.web.d.ts +1 -2
  13. package/build/elements/Rules.web.d.ts.map +1 -1
  14. package/build/elements/Table.d.ts +9 -9
  15. package/build/elements/Table.d.ts.map +1 -1
  16. package/build/elements/Table.web.d.ts.map +1 -1
  17. package/build/elements/Text.d.ts +15 -15
  18. package/build/elements/Text.d.ts.map +1 -1
  19. package/build/primitives/RNWView.d.ts +4 -2
  20. package/build/primitives/RNWView.d.ts.map +1 -1
  21. package/build/primitives/createDevView.d.ts +1 -1
  22. package/build/primitives/createDevView.d.ts.map +1 -1
  23. package/jest-setup.js +1 -0
  24. package/package.json +13 -7
  25. package/{build/Elements.js → src/Elements.tsx} +0 -1
  26. package/src/css/__tests__/__snapshots__/createSafeStyledView.test.native.tsx.snap.android +31 -0
  27. package/src/css/__tests__/__snapshots__/createSafeStyledView.test.native.tsx.snap.ios +31 -0
  28. package/src/css/__tests__/createSafeStyledView.test.native.tsx +54 -0
  29. package/src/css/createSafeStyledView.native.tsx +12 -0
  30. package/src/css/createSafeStyledView.tsx +4 -0
  31. package/src/css/filterStyles.ts +92 -0
  32. package/src/css/units.ts +11 -0
  33. package/src/elements/Anchor.tsx +27 -0
  34. package/src/elements/Headings.tsx +81 -0
  35. package/src/elements/Layout.tsx +72 -0
  36. package/src/elements/Lists.tsx +45 -0
  37. package/src/elements/Rules.tsx +18 -0
  38. package/src/elements/Rules.web.tsx +7 -0
  39. package/src/elements/Table.tsx +59 -0
  40. package/src/elements/Table.web.tsx +38 -0
  41. package/src/elements/Text.tsx +111 -0
  42. package/src/elements/Text.types.ts +21 -0
  43. package/src/elements/__tests__/Anchor.test.ios.tsx +10 -0
  44. package/src/elements/__tests__/Anchor.test.web.tsx +11 -0
  45. package/src/elements/__tests__/Headings.test.ios.tsx +13 -0
  46. package/src/elements/__tests__/Layout.test.ios.tsx +40 -0
  47. package/src/elements/__tests__/Layout.test.web.tsx +50 -0
  48. package/src/elements/__tests__/Lists.test.native.tsx +17 -0
  49. package/src/elements/__tests__/Lists.test.web.tsx +41 -0
  50. package/src/elements/__tests__/Rules.test.native.tsx +10 -0
  51. package/src/elements/__tests__/Rules.test.web.tsx +8 -0
  52. package/src/elements/__tests__/Table.test.ios.tsx +45 -0
  53. package/src/elements/__tests__/Table.test.web.tsx +49 -0
  54. package/src/elements/__tests__/Text.test.ios.tsx +102 -0
  55. package/src/elements/__tests__/__snapshots__/Anchor-test.tsx.snap.android +8 -0
  56. package/src/elements/__tests__/__snapshots__/Anchor-test.tsx.snap.ios +8 -0
  57. package/src/elements/__tests__/__snapshots__/Anchor-test.tsx.snap.web +12 -0
  58. package/src/elements/__tests__/__snapshots__/Anchor.test.ios.tsx.snap.ios +8 -0
  59. package/src/elements/__tests__/__snapshots__/Anchor.test.tsx.snap.android +8 -0
  60. package/src/elements/__tests__/__snapshots__/Anchor.test.tsx.snap.ios +8 -0
  61. package/src/elements/__tests__/__snapshots__/Anchor.test.tsx.snap.web +12 -0
  62. package/src/elements/__tests__/__snapshots__/Headings-test.tsx.snap.android +79 -0
  63. package/src/elements/__tests__/__snapshots__/Headings-test.tsx.snap.ios +79 -0
  64. package/src/elements/__tests__/__snapshots__/Headings-test.tsx.snap.web +61 -0
  65. package/src/elements/__tests__/__snapshots__/Headings.test.ios.tsx.snap.ios +79 -0
  66. package/src/elements/__tests__/__snapshots__/Layout-test.tsx.snap.android +23 -0
  67. package/src/elements/__tests__/__snapshots__/Layout-test.tsx.snap.ios +23 -0
  68. package/src/elements/__tests__/__snapshots__/Layout-test.tsx.snap.web +64 -0
  69. package/src/elements/__tests__/__snapshots__/Layout.test.ios.tsx.snap.ios +23 -0
  70. package/src/elements/__tests__/__snapshots__/Layout.test.tsx.snap.android +23 -0
  71. package/src/elements/__tests__/__snapshots__/Layout.test.tsx.snap.ios +23 -0
  72. package/src/elements/__tests__/__snapshots__/Layout.test.tsx.snap.web +64 -0
  73. package/src/elements/__tests__/__snapshots__/Lists-test.tsx.snap.android +14 -0
  74. package/src/elements/__tests__/__snapshots__/Lists-test.tsx.snap.ios +14 -0
  75. package/src/elements/__tests__/__snapshots__/Lists-test.tsx.snap.web +34 -0
  76. package/src/elements/__tests__/__snapshots__/Lists.test.native.tsx.snap.android +14 -0
  77. package/src/elements/__tests__/__snapshots__/Lists.test.native.tsx.snap.ios +14 -0
  78. package/src/elements/__tests__/__snapshots__/Rules-test.tsx.snap.android +15 -0
  79. package/src/elements/__tests__/__snapshots__/Rules-test.tsx.snap.ios +15 -0
  80. package/src/elements/__tests__/__snapshots__/Rules-test.tsx.snap.web +7 -0
  81. package/src/elements/__tests__/__snapshots__/Rules.test.native.tsx.snap.android +15 -0
  82. package/src/elements/__tests__/__snapshots__/Rules.test.native.tsx.snap.ios +15 -0
  83. package/src/elements/__tests__/__snapshots__/Table-test.tsx.snap.android +60 -0
  84. package/src/elements/__tests__/__snapshots__/Table-test.tsx.snap.ios +60 -0
  85. package/src/elements/__tests__/__snapshots__/Table-test.tsx.snap.web +71 -0
  86. package/src/elements/__tests__/__snapshots__/Table.test.ios.tsx.snap.ios +60 -0
  87. package/src/elements/__tests__/__snapshots__/Table.test.tsx.snap.android +60 -0
  88. package/src/elements/__tests__/__snapshots__/Table.test.tsx.snap.ios +60 -0
  89. package/src/elements/__tests__/__snapshots__/Table.test.tsx.snap.web +71 -0
  90. package/src/elements/__tests__/__snapshots__/Text-test.tsx.snap.android +174 -0
  91. package/src/elements/__tests__/__snapshots__/Text-test.tsx.snap.ios +174 -0
  92. package/src/elements/__tests__/__snapshots__/Text-test.tsx.snap.web +149 -0
  93. package/src/elements/__tests__/__snapshots__/Text.test.ios.tsx.snap.ios +174 -0
  94. package/src/primitives/Image.tsx +30 -0
  95. package/src/primitives/RNWView.tsx +178 -0
  96. package/src/primitives/Table.ts +14 -0
  97. package/src/primitives/Text.tsx +68 -0
  98. package/src/primitives/View.tsx +145 -0
  99. package/src/primitives/__tests__/__snapshots__/createDevView.test.ios.tsx.snap.ios +35 -0
  100. package/src/primitives/__tests__/__snapshots__/createDevView.test.tsx.snap.android +35 -0
  101. package/src/primitives/__tests__/__snapshots__/createDevView.test.tsx.snap.ios +35 -0
  102. package/src/primitives/__tests__/__snapshots__/createDevView.test.tsx.snap.web +30 -0
  103. package/src/primitives/__tests__/__snapshots__/createDevView.test.web.tsx.snap.web +27 -0
  104. package/src/primitives/__tests__/createDevView.test.tsx +53 -0
  105. package/src/primitives/createDevView.tsx +48 -0
  106. package/src/ts-declarations/process.d.ts +7 -0
  107. package/src/ts-declarations/react-native-web.d.ts +1016 -0
  108. package/tsconfig.json +2 -2
  109. package/build/Elements.js.map +0 -1
  110. package/build/css/createSafeStyledView.js +0 -5
  111. package/build/css/createSafeStyledView.js.map +0 -1
  112. package/build/css/createSafeStyledView.native.js +0 -10
  113. package/build/css/createSafeStyledView.native.js.map +0 -1
  114. package/build/css/filterStyles.js +0 -83
  115. package/build/css/filterStyles.js.map +0 -1
  116. package/build/css/units.js +0 -12
  117. package/build/css/units.js.map +0 -1
  118. package/build/elements/Anchor.js +0 -25
  119. package/build/elements/Anchor.js.map +0 -1
  120. package/build/elements/Headings.js +0 -78
  121. package/build/elements/Headings.js.map +0 -1
  122. package/build/elements/Layout.js +0 -46
  123. package/build/elements/Layout.js.map +0 -1
  124. package/build/elements/Lists.js +0 -33
  125. package/build/elements/Lists.js.map +0 -1
  126. package/build/elements/Rules.js +0 -16
  127. package/build/elements/Rules.js.map +0 -1
  128. package/build/elements/Rules.web.js +0 -6
  129. package/build/elements/Rules.web.js.map +0 -1
  130. package/build/elements/Table.js +0 -50
  131. package/build/elements/Table.js.map +0 -1
  132. package/build/elements/Table.web.js +0 -27
  133. package/build/elements/Table.web.js.map +0 -1
  134. package/build/elements/Text.js +0 -92
  135. package/build/elements/Text.js.map +0 -1
  136. package/build/elements/Text.types.js +0 -2
  137. package/build/elements/Text.types.js.map +0 -1
  138. package/build/primitives/Image.js +0 -5
  139. package/build/primitives/Image.js.map +0 -1
  140. package/build/primitives/RNWView.js +0 -122
  141. package/build/primitives/RNWView.js.map +0 -1
  142. package/build/primitives/Table.js +0 -3
  143. package/build/primitives/Table.js.map +0 -1
  144. package/build/primitives/Text.js +0 -5
  145. package/build/primitives/Text.js.map +0 -1
  146. package/build/primitives/View.js +0 -10
  147. package/build/primitives/View.js.map +0 -1
  148. package/build/primitives/createDevView.js +0 -43
  149. package/build/primitives/createDevView.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,20 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.12.4 — 2025-04-25
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
17
+ ## 0.12.3 — 2025-04-22
18
+
19
+ ### 🛠 Breaking changes
20
+
21
+ - Upgrade to React 19 and remove compiled build code. ([#36273](https://github.com/expo/expo/pull/36273) by [@EvanBacon](https://github.com/EvanBacon))
22
+
23
+ ### 💡 Others
24
+
25
+ - Switch web testing to `@testing-library/react`. ([#36293](https://github.com/expo/expo/pull/36293) by [@EvanBacon](https://github.com/EvanBacon))
26
+
13
27
  ## 0.12.2 — 2025-04-14
14
28
 
15
29
  _This version does not introduce any user-facing changes._
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- export declare function createSafeStyledView<TView extends React.ComponentType<any>>(View: TView): React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<TView>>;
2
+ export declare function createSafeStyledView<TView extends React.ComponentType<any>>(View: TView): ({ style, ...props }: any) => React.JSX.Element;
3
3
  //# sourceMappingURL=createSafeStyledView.native.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createSafeStyledView.native.d.ts","sourceRoot":"","sources":["../../src/css/createSafeStyledView.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,wBAAgB,oBAAoB,CAAC,KAAK,SAAS,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,kFAOvF"}
1
+ {"version":3,"file":"createSafeStyledView.native.d.ts","sourceRoot":"","sources":["../../src/css/createSafeStyledView.native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAIvC,wBAAgB,oBAAoB,CAAC,KAAK,SAAS,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,IACjE,qBAAqB,GAAG,uBAM9C"}
@@ -1,4 +1,4 @@
1
- import { ComponentType } from 'react';
1
+ import React from 'react';
2
2
  import { LinkProps } from './Text.types';
3
- export declare const A: ComponentType<LinkProps>;
3
+ export declare function A({ href, target, download, rel, ...props }: LinkProps): React.JSX.Element;
4
4
  //# sourceMappingURL=Anchor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../src/elements/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,eAAO,MAAM,CAAC,EAoBR,aAAa,CAAC,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"Anchor.d.ts","sourceRoot":"","sources":["../../src/elements/Anchor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,wBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAoBrE"}
@@ -1 +1 @@
1
- {"version":3,"file":"Headings.d.ts","sourceRoot":"","sources":["../../src/elements/Headings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAqBrD,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC"}
1
+ {"version":3,"file":"Headings.d.ts","sourceRoot":"","sources":["../../src/elements/Headings.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAI7C,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAyBrD,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC;AAC5C,eAAO,MAAM,EAAE,gCAA4B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/elements/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQrD,eAAO,MAAM,GAAG,gCAAe,CAAC;AAEhC,eAAO,MAAM,GAAG,gCAMf,CAAC;AACF,eAAO,MAAM,MAAM,gCAMlB,CAAC;AACF,eAAO,MAAM,KAAK,gCAMjB,CAAC;AACF,eAAO,MAAM,MAAM,gCASlB,CAAC;AACF,eAAO,MAAM,IAAI,gCAMhB,CAAC;AACF,eAAO,MAAM,OAAO,gCAMnB,CAAC;AACF,eAAO,MAAM,OAAO,gCAElB,CAAC"}
1
+ {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/elements/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAG7C,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQrD,eAAO,MAAM,GAAG,gCAAe,CAAC;AAEhC,eAAO,MAAM,GAAG,gCAMf,CAAC;AACF,eAAO,MAAM,MAAM,gCAMlB,CAAC;AACF,eAAO,MAAM,KAAK,gCAMjB,CAAC;AACF,eAAO,MAAM,MAAM,gCASlB,CAAC;AACF,eAAO,MAAM,IAAI,gCAMhB,CAAC;AACF,eAAO,MAAM,OAAO,gCAMnB,CAAC;AACF,eAAO,MAAM,OAAO,gCAElB,CAAC"}
@@ -1,8 +1,8 @@
1
- import React, { ComponentType } from 'react';
1
+ import React, { PropsWithChildren } from 'react';
2
2
  import { TextProps } from '../primitives/Text';
3
3
  import { ViewProps } from '../primitives/View';
4
4
  export declare const UL: React.ComponentType<ViewProps>;
5
5
  type LIProps = TextProps | ViewProps;
6
- export declare const LI: ComponentType<LIProps>;
6
+ export declare function LI(props: PropsWithChildren<LIProps>): React.JSX.Element;
7
7
  export {};
8
8
  //# sourceMappingURL=Lists.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Lists.d.ts","sourceRoot":"","sources":["../../src/elements/Lists.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAiC,MAAM,OAAO,CAAC;AAG5E,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQrD,eAAO,MAAM,EAAE,gCAMd,CAAC;AAOF,KAAK,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAErC,eAAO,MAAM,EAAE,EAaT,aAAa,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"Lists.d.ts","sourceRoot":"","sources":["../../src/elements/Lists.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAGhE,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAQrD,eAAO,MAAM,EAAE,gCAMd,CAAC;AAWF,KAAK,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AAErC,wBAAgB,EAAE,CAAC,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,qBAanD"}
@@ -1,4 +1,4 @@
1
- import { ComponentType } from 'react';
1
+ import React from 'react';
2
2
  import { ViewProps } from '../primitives/View';
3
- export declare const HR: ComponentType<ViewProps>;
3
+ export declare function HR(props: ViewProps): React.JSX.Element;
4
4
  //# sourceMappingURL=Rules.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Rules.d.ts","sourceRoot":"","sources":["../../src/elements/Rules.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAGzD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,EAAE,EAET,aAAa,CAAC,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"Rules.d.ts","sourceRoot":"","sources":["../../src/elements/Rules.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAgB,EAAE,CAAC,KAAK,EAAE,SAAS,qBAElC"}
@@ -1,4 +1,3 @@
1
- import { ComponentType } from 'react';
2
1
  import { ViewProps } from '../primitives/View';
3
- export declare const HR: ComponentType<ViewProps>;
2
+ export declare function HR(props: ViewProps): import("react").ReactElement<import("../primitives/View").WebViewProps & Omit<import("react-native").ViewProps & import("react").ClassAttributes<typeof import("react-native").View>, "style">, string | import("react").JSXElementConstructor<any>>;
4
3
  //# sourceMappingURL=Rules.web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Rules.web.d.ts","sourceRoot":"","sources":["../../src/elements/Rules.web.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAGlD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,eAAO,MAAM,EAAE,EAET,aAAa,CAAC,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"Rules.web.d.ts","sourceRoot":"","sources":["../../src/elements/Rules.web.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,wBAAgB,EAAE,CAAC,KAAK,EAAE,SAAS,wPAElC"}
@@ -1,13 +1,13 @@
1
- import { ComponentType } from 'react';
1
+ import React from 'react';
2
2
  import { TableTextProps } from '../primitives/Table';
3
3
  import { TextProps } from '../primitives/Text';
4
4
  import { ViewProps } from '../primitives/View';
5
- export declare const Table: ComponentType<ViewProps>;
6
- export declare const THead: ComponentType<ViewProps>;
7
- export declare const TBody: ComponentType<ViewProps>;
8
- export declare const TFoot: ComponentType<ViewProps>;
9
- export declare const TH: ComponentType<TableTextProps>;
10
- export declare const TR: ComponentType<ViewProps>;
11
- export declare const TD: ComponentType<TableTextProps>;
12
- export declare const Caption: ComponentType<TextProps>;
5
+ export declare function Table(props: ViewProps): React.JSX.Element;
6
+ export declare function THead(props: ViewProps): React.JSX.Element;
7
+ export declare function TBody(props: ViewProps): React.JSX.Element;
8
+ export declare function TFoot(props: ViewProps): React.JSX.Element;
9
+ export declare function TH(props: TableTextProps): React.JSX.Element;
10
+ export declare function TR(props: ViewProps): React.JSX.Element;
11
+ export declare function TD(props: TableTextProps): React.JSX.Element;
12
+ export declare function Caption(props: TextProps): React.JSX.Element;
13
13
  //# sourceMappingURL=Table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/elements/Table.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAIzD,OAAO,EAAa,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,KAAK,EAEZ,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,KAAK,EAEZ,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,KAAK,EAEZ,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,KAAK,EAEZ,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,EAAE,EAET,aAAa,CAAC,cAAc,CAAC,CAAC;AAEpC,eAAO,MAAM,EAAE,EAET,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,EAAE,EAET,aAAa,CAAC,cAAc,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAEd,aAAa,CAAC,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../src/elements/Table.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAa,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,qBAErC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,qBAErC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,qBAErC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,qBAErC;AAED,wBAAgB,EAAE,CAAC,KAAK,EAAE,cAAc,qBAEvC;AAED,wBAAgB,EAAE,CAAC,KAAK,EAAE,SAAS,qBAElC;AAED,wBAAgB,EAAE,CAAC,KAAK,EAAE,cAAc,qBAEvC;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,qBAEvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Table.web.d.ts","sourceRoot":"","sources":["../../src/elements/Table.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAGzD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAS/C,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,EAAE,gCAAkC,CAAC;AAElD,eAAO,MAAM,EAAE,gCAAkC,CAAC;AAElD,eAAO,MAAM,EAAE,gCAAkC,CAAC;AAElD,eAAO,MAAM,OAAO,gCAAuC,CAAC"}
1
+ {"version":3,"file":"Table.web.d.ts","sourceRoot":"","sources":["../../src/elements/Table.web.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAG7C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAS/C,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,KAAK,gCAAqC,CAAC;AAExD,eAAO,MAAM,EAAE,gCAAkC,CAAC;AAElD,eAAO,MAAM,EAAE,gCAAkC,CAAC;AAElD,eAAO,MAAM,EAAE,gCAAkC,CAAC;AAElD,eAAO,MAAM,OAAO,gCAAuC,CAAC"}
@@ -1,22 +1,22 @@
1
- import React, { ComponentType } from 'react';
1
+ import React from 'react';
2
2
  import { BlockQuoteProps, QuoteProps, TimeProps } from './Text.types';
3
3
  import { TextProps } from '../primitives/Text';
4
4
  import { ViewProps } from '../primitives/View';
5
- export declare const P: ComponentType<TextProps>;
6
- export declare const B: ComponentType<TextProps>;
7
- export declare const S: ComponentType<TextProps>;
8
- export declare const I: ComponentType<TextProps>;
9
- export declare const Q: ComponentType<QuoteProps>;
10
- export declare const BlockQuote: ComponentType<BlockQuoteProps>;
11
- export declare const BR: ComponentType<TextProps>;
12
- export declare const Mark: ComponentType<TextProps>;
13
- export declare const Code: ComponentType<TextProps>;
5
+ export declare function P({ style, ...props }: TextProps): React.JSX.Element;
6
+ export declare function B({ style, ...props }: TextProps): React.JSX.Element;
7
+ export declare function S({ style, ...props }: TextProps): React.JSX.Element;
8
+ export declare function I({ style, ...props }: TextProps): React.JSX.Element;
9
+ export declare function Q({ children, cite, style, ...props }: QuoteProps): React.JSX.Element;
10
+ export declare function BlockQuote({ style, cite, ...props }: BlockQuoteProps): React.JSX.Element;
11
+ export declare function BR({ style, ...props }: TextProps): React.JSX.Element;
12
+ export declare function Mark({ style, ...props }: TextProps): React.JSX.Element;
13
+ export declare function Code({ style, ...props }: TextProps): React.JSX.Element;
14
14
  type PreProps = TextProps | ViewProps;
15
- export declare const Pre: ComponentType<PreProps>;
16
- export declare const Time: ComponentType<TimeProps>;
17
- export declare const Strong: React.ComponentType<TextProps>;
18
- export declare const Del: React.ComponentType<TextProps>;
19
- export declare const EM: React.ComponentType<TextProps>;
15
+ export declare function Pre(props: PreProps): React.JSX.Element;
16
+ export declare function Time({ dateTime, ...props }: TimeProps): React.JSX.Element;
17
+ export declare const Strong: typeof B;
18
+ export declare const Del: typeof S;
19
+ export declare const EM: typeof I;
20
20
  export declare const Span: React.ComponentType<TextProps>;
21
21
  export {};
22
22
  //# sourceMappingURL=Text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/elements/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAGzD,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD,eAAO,MAAM,CAAC,EAER,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,CAAC,EAER,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,CAAC,EAER,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,CAAC,EAER,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,CAAC,EAMR,aAAa,CAAC,UAAU,CAAC,CAAC;AAEhC,eAAO,MAAM,UAAU,EAEjB,aAAa,CAAC,eAAe,CAAC,CAAC;AAErC,eAAO,MAAM,EAAE,EAET,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,IAAI,EAEX,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,IAAI,EAEX,aAAa,CAAC,SAAS,CAAC,CAAC;AAM/B,KAAK,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtC,eAAO,MAAM,GAAG,EAKV,aAAa,CAAC,QAAQ,CAAC,CAAC;AAG9B,eAAO,MAAM,IAAI,EAEX,aAAa,CAAC,SAAS,CAAC,CAAC;AAE/B,eAAO,MAAM,MAAM,gCAAI,CAAC;AACxB,eAAO,MAAM,GAAG,gCAAI,CAAC;AACrB,eAAO,MAAM,EAAE,gCAAI,CAAC;AACpB,eAAO,MAAM,IAAI,gCAAO,CAAC"}
1
+ {"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/elements/Text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEtE,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD,wBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAE/C;AAED,wBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAE/C;AAED,wBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAE/C;AAED,wBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAE/C;AAED,wBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,UAAU,qBAMhE;AAED,wBAAgB,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,qBAEpE;AAED,wBAAgB,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAEhD;AAED,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAElD;AAED,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAElD;AAMD,KAAK,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtC,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,qBAKlC;AAGD,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAErD;AAED,eAAO,MAAM,MAAM,UAAI,CAAC;AACxB,eAAO,MAAM,GAAG,UAAI,CAAC;AACrB,eAAO,MAAM,EAAE,UAAI,CAAC;AACpB,eAAO,MAAM,IAAI,gCAAO,CAAC"}
@@ -8,12 +8,14 @@
8
8
  */
9
9
  import * as React from 'react';
10
10
  import { ViewProps } from 'react-native-web/dist/exports/View/types';
11
- import { PlatformMethods } from 'react-native-web/dist/types';
12
11
  /**
13
12
  * This is the View from react-native-web copied out in order to supply a custom `__element` property.
14
13
  * In the past, you could use `createElement` to create an element with a custom HTML element, but this changed
15
14
  * somewhere between 0.14...0.17.
16
15
  */
17
- declare const View: React.ForwardRefExoticComponent<HTMLElement & PlatformMethods & React.RefAttributes<ViewProps>>;
16
+ declare function View(props: ViewProps): React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
17
+ declare namespace View {
18
+ var displayName: string;
19
+ }
18
20
  export default View;
19
21
  //# sourceMappingURL=RNWView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RNWView.d.ts","sourceRoot":"","sources":["../../src/primitives/RNWView.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AASrE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AA4B9D;;;;GAIG;AAEH,QAAA,MAAM,IAAI,iGAyFR,CAAC;AA8BH,eAAe,IAAI,CAAC"}
1
+ {"version":3,"file":"RNWView.d.ts","sourceRoot":"","sources":["../../src/primitives/RNWView.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,SAAS,EAAE,MAAM,0CAA0C,CAAC;AAoCrE;;;;GAIG;AAEH,iBAAS,IAAI,CAAC,KAAK,EAAE,SAAS,iGA8F7B;kBA9FQ,IAAI;;;AA4Hb,eAAe,IAAI,CAAC"}
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  /** Extend a view with a `children` filter that asserts more helpful warnings/errors. */
3
- export declare function createDevView<TView extends React.ComponentType<any>>(View: TView): React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<TView>>;
3
+ export declare function createDevView<TView extends React.ComponentType<any>>(View: TView): ({ children, ...props }: any) => React.JSX.Element;
4
4
  //# sourceMappingURL=createDevView.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createDevView.d.ts","sourceRoot":"","sources":["../../src/primitives/createDevView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmC1B,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,KAAK,SAAS,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,kFAIhF"}
1
+ {"version":3,"file":"createDevView.d.ts","sourceRoot":"","sources":["../../src/primitives/createDevView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmC1B,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,KAAK,SAAS,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,IACvD,wBAAwB,GAAG,uBAGpD"}
package/jest-setup.js ADDED
@@ -0,0 +1 @@
1
+ import '@testing-library/jest-dom';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@expo/html-elements",
3
- "version": "0.12.2",
3
+ "version": "0.12.4",
4
4
  "description": "Universal semantic HTML React components for iOS, Android, web, and desktop",
5
- "main": "build/Elements.js",
5
+ "main": "src/Elements.tsx",
6
6
  "types": "build/Elements.d.ts",
7
7
  "sideEffects": false,
8
8
  "scripts": {
@@ -37,19 +37,22 @@
37
37
  "jest": {
38
38
  "projects": [
39
39
  {
40
- "preset": "jest-expo/ios",
40
+ "preset": "jest-expo/web",
41
+ "setupFilesAfterEnv": [
42
+ "<rootDir>/jest-setup.js"
43
+ ],
41
44
  "modulePathIgnorePatterns": [
42
45
  "<rootDir>/babel/"
43
46
  ]
44
47
  },
45
48
  {
46
- "preset": "jest-expo/android",
49
+ "preset": "jest-expo/ios",
47
50
  "modulePathIgnorePatterns": [
48
51
  "<rootDir>/babel/"
49
52
  ]
50
53
  },
51
54
  {
52
- "preset": "jest-expo/web",
55
+ "preset": "jest-expo/android",
53
56
  "modulePathIgnorePatterns": [
54
57
  "<rootDir>/babel/"
55
58
  ]
@@ -57,7 +60,10 @@
57
60
  ]
58
61
  },
59
62
  "devDependencies": {
60
- "expo-module-scripts": "^4.1.2"
63
+ "expo-module-scripts": "^4.1.5",
64
+ "@testing-library/jest-dom": "^5.16.5",
65
+ "@testing-library/react": "^15.0.7",
66
+ "@testing-library/react-native": "^13.1.0"
61
67
  },
62
- "gitHead": "335e9312f5caf634097354a230f0d4bbbfb9b0ba"
68
+ "gitHead": "4e542b7b761cfea341d554dd7958103aff5f68c6"
63
69
  }
@@ -5,4 +5,3 @@ export * from './elements/Text';
5
5
  export * from './elements/Rules';
6
6
  export * from './elements/Table';
7
7
  export * from './elements/Lists';
8
- //# sourceMappingURL=Elements.js.map
@@ -0,0 +1,31 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`mocks out visibility: hidden by lowering the opacity 1`] = `
4
+ <View
5
+ style={
6
+ {
7
+ "opacity": 0,
8
+ }
9
+ }
10
+ />
11
+ `;
12
+
13
+ exports[`replaces invalid position with "relative" 1`] = `
14
+ <View
15
+ style={
16
+ {
17
+ "position": "relative",
18
+ }
19
+ }
20
+ />
21
+ `;
22
+
23
+ exports[`strips invalid style properties 1`] = `
24
+ <View
25
+ style={
26
+ {
27
+ "position": "absolute",
28
+ }
29
+ }
30
+ />
31
+ `;
@@ -0,0 +1,31 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`mocks out visibility: hidden by lowering the opacity 1`] = `
4
+ <View
5
+ style={
6
+ {
7
+ "opacity": 0,
8
+ }
9
+ }
10
+ />
11
+ `;
12
+
13
+ exports[`replaces invalid position with "relative" 1`] = `
14
+ <View
15
+ style={
16
+ {
17
+ "position": "relative",
18
+ }
19
+ }
20
+ />
21
+ `;
22
+
23
+ exports[`strips invalid style properties 1`] = `
24
+ <View
25
+ style={
26
+ {
27
+ "position": "absolute",
28
+ }
29
+ }
30
+ />
31
+ `;
@@ -0,0 +1,54 @@
1
+ import { render } from '@testing-library/react-native';
2
+ import * as React from 'react';
3
+
4
+ import View from '../../primitives/View';
5
+ import { createSafeStyledView } from '../createSafeStyledView';
6
+
7
+ const Safe = createSafeStyledView(View);
8
+
9
+ const originalConsoleError = console.error;
10
+ const originalConsoleWarn = console.warn;
11
+
12
+ beforeEach(() => {
13
+ console.error = jest.fn();
14
+ console.warn = jest.fn();
15
+ });
16
+ afterAll(() => {
17
+ console.error = originalConsoleError;
18
+ console.warn = originalConsoleWarn;
19
+ });
20
+
21
+ it('strips invalid style properties', () => {
22
+ const { toJSON } = render(
23
+ <Safe
24
+ style={{
25
+ transitionDuration: '200ms',
26
+ position: 'absolute',
27
+ }}
28
+ />
29
+ );
30
+ expect(toJSON()).toMatchSnapshot();
31
+ });
32
+
33
+ it('replaces invalid position with "relative"', () => {
34
+ const { toJSON } = render(
35
+ <Safe
36
+ style={{
37
+ position: 'fixed',
38
+ }}
39
+ />
40
+ );
41
+ expect(toJSON()).toMatchSnapshot();
42
+ expect(console.warn).toBeCalledWith(`Unsupported position: 'fixed'`);
43
+ });
44
+
45
+ it('mocks out visibility: hidden by lowering the opacity', () => {
46
+ const { toJSON } = render(
47
+ <Safe
48
+ style={{
49
+ visibility: 'hidden',
50
+ }}
51
+ />
52
+ );
53
+ expect(toJSON()).toMatchSnapshot();
54
+ });
@@ -0,0 +1,12 @@
1
+ import React, { useMemo } from 'react';
2
+
3
+ import { filterStyles } from './filterStyles';
4
+
5
+ export function createSafeStyledView<TView extends React.ComponentType<any>>(View: TView) {
6
+ return function Safe({ style, ...props }: any) {
7
+ // Filter and apply `center` prop.
8
+ const finalStyle = useMemo(() => filterStyles(style), [style]);
9
+
10
+ return <View style={finalStyle} {...props} />;
11
+ };
12
+ }
@@ -0,0 +1,4 @@
1
+ export function createSafeStyledView<TView>(View: TView) {
2
+ // Do nothing by default
3
+ return View;
4
+ }
@@ -0,0 +1,92 @@
1
+ import type { CSSProperties } from 'react';
2
+ import { type StyleProp, StyleSheet } from 'react-native';
3
+
4
+ // Remove the unsupported web styles from the style object
5
+ // to prevent crashing.
6
+ const WEB_STYLES = [
7
+ 'backdropFilter',
8
+ 'animationDelay',
9
+ 'animationDirection',
10
+ 'animationDuration',
11
+ 'animationFillMode',
12
+ 'animationName',
13
+ 'animationIterationCount',
14
+ 'animationPlayState',
15
+ 'animationTimingFunction',
16
+ 'backgroundAttachment',
17
+ 'backgroundBlendMode',
18
+ 'backgroundClip',
19
+ 'backgroundImage',
20
+ 'backgroundOrigin',
21
+ 'backgroundPosition',
22
+ 'backgroundRepeat',
23
+ 'backgroundSize',
24
+ 'boxShadow',
25
+ 'boxSizing',
26
+ 'clip',
27
+ 'cursor',
28
+ 'filter',
29
+ 'gridAutoColumns',
30
+ 'gridAutoFlow',
31
+ 'gridAutoRows',
32
+ 'gridColumnEnd',
33
+ 'gridColumnGap',
34
+ 'gridColumnStart',
35
+ 'gridRowEnd',
36
+ 'gridRowGap',
37
+ 'gridRowStart',
38
+ 'gridTemplateColumns',
39
+ 'gridTemplateRows',
40
+ 'gridTemplateAreas',
41
+ 'outline',
42
+ 'outlineColor',
43
+ 'overflowX',
44
+ 'overflowY',
45
+ 'overscrollBehavior',
46
+ 'overscrollBehaviorX',
47
+ 'overscrollBehaviorY',
48
+ 'perspective',
49
+ 'perspectiveOrigin',
50
+ 'touchAction',
51
+ 'transformOrigin',
52
+ 'transitionDelay',
53
+ 'transitionDuration',
54
+ 'transitionProperty',
55
+ 'transitionTimingFunction',
56
+ 'userSelect',
57
+ 'willChange',
58
+ ];
59
+
60
+ export function filterStyles(styleProp: StyleProp<any>) {
61
+ if (!styleProp) {
62
+ return styleProp;
63
+ }
64
+ const style = StyleSheet.flatten(styleProp);
65
+
66
+ const filteredStyle = Object.fromEntries(
67
+ Object.entries(style).filter(([k]) => !WEB_STYLES.includes(k))
68
+ );
69
+
70
+ return processNativeStyles(filteredStyle);
71
+ }
72
+
73
+ function processNativeStyles(style: CSSProperties) {
74
+ if (!style) return style;
75
+
76
+ if (style.visibility) {
77
+ if (style.visibility === 'hidden') {
78
+ // style.display = "none";
79
+ style.opacity = 0;
80
+ }
81
+ delete style.visibility;
82
+ }
83
+
84
+ if (style.position) {
85
+ if (!['absolute', 'relative'].includes(style.position)) {
86
+ console.warn(`Unsupported position: '${style.position}'`);
87
+ style.position = 'relative';
88
+ }
89
+ }
90
+
91
+ return style;
92
+ }
@@ -0,0 +1,11 @@
1
+ import { PixelRatio, Platform } from 'react-native';
2
+
3
+ export function rem(value: number): number | string {
4
+ if (Platform.OS === 'web') return `${value}rem`;
5
+ return PixelRatio.getFontScale() * 16 * value;
6
+ }
7
+
8
+ export function em(value: number): number | string {
9
+ if (Platform.OS === 'web') return `${value}em`;
10
+ return rem(value);
11
+ }
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { Linking, Platform } from 'react-native';
3
+
4
+ import { LinkProps } from './Text.types';
5
+ import Text from '../primitives/Text';
6
+
7
+ export function A({ href, target, download, rel, ...props }: LinkProps) {
8
+ const nativeProps = Platform.select<LinkProps>({
9
+ web: {
10
+ href,
11
+ hrefAttrs: {
12
+ target,
13
+ download,
14
+ rel,
15
+ },
16
+ },
17
+ default: {
18
+ onPress: (event) => {
19
+ props.onPress && props.onPress(event);
20
+ if (Platform.OS !== 'web' && href !== undefined) {
21
+ Linking.openURL(href);
22
+ }
23
+ },
24
+ },
25
+ });
26
+ return <Text role="link" {...props} {...nativeProps} />;
27
+ }
@@ -0,0 +1,81 @@
1
+ import React, { ComponentType } from 'react';
2
+ import { Platform, StyleSheet } from 'react-native';
3
+
4
+ import { em } from '../css/units';
5
+ import Text, { TextProps } from '../primitives/Text';
6
+
7
+ type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
8
+
9
+ function createHeadingComponent(level: HeadingLevel): ComponentType<TextProps> {
10
+ const nativeProps: any = Platform.select({
11
+ web: {
12
+ 'aria-level': level,
13
+ role: 'header',
14
+ },
15
+ default: {
16
+ accessibilityRole: 'header',
17
+ },
18
+ });
19
+ function Heading(props: TextProps) {
20
+ return <Text {...nativeProps} {...props} style={[styles[`h${level}`], props.style]} />;
21
+ }
22
+
23
+ if (__DEV__) {
24
+ Heading.displayName = `H${level}`;
25
+ }
26
+
27
+ return Heading;
28
+ }
29
+
30
+ export const H1 = createHeadingComponent(1);
31
+ export const H2 = createHeadingComponent(2);
32
+ export const H3 = createHeadingComponent(3);
33
+ export const H4 = createHeadingComponent(4);
34
+ export const H5 = createHeadingComponent(5);
35
+ export const H6 = createHeadingComponent(6);
36
+
37
+ // Default web styles: http://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css
38
+ const styles = StyleSheet.create({
39
+ h1: {
40
+ // @ts-ignore
41
+ fontSize: em(2),
42
+ // @ts-ignore
43
+ marginVertical: em(0.67),
44
+ fontWeight: 'bold',
45
+ },
46
+ h2: {
47
+ // @ts-ignore
48
+ fontSize: em(1.5),
49
+ // @ts-ignore
50
+ marginVertical: em(0.83),
51
+ fontWeight: 'bold',
52
+ },
53
+ h3: {
54
+ // @ts-ignore
55
+ fontSize: em(1.17),
56
+ // @ts-ignore
57
+ marginVertical: em(1),
58
+ fontWeight: 'bold',
59
+ },
60
+ h4: {
61
+ // @ts-ignore
62
+ fontSize: em(1),
63
+ // @ts-ignore
64
+ marginVertical: em(1.33),
65
+ fontWeight: 'bold',
66
+ },
67
+ h5: {
68
+ // @ts-ignore
69
+ fontSize: em(0.83),
70
+ // @ts-ignore
71
+ marginVertical: em(1.67),
72
+ fontWeight: 'bold',
73
+ },
74
+ h6: {
75
+ // @ts-ignore
76
+ fontSize: em(0.67),
77
+ // @ts-ignore
78
+ marginVertical: em(2.33),
79
+ fontWeight: 'bold',
80
+ },
81
+ });