@rootnative/web 0.0.0-alpha.0 → 0.0.0-alpha.2
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 +47 -1
- package/README.md +7 -6
- package/dist/{StyleRegistryContext-ButsUd8D.js → StyleRegistryContext-CAD45r4n.js} +3 -8
- package/dist/StyleRegistryContext-CAD45r4n.js.map +1 -0
- package/dist/env-DK5Mt9yX.js +9 -0
- package/dist/env-DK5Mt9yX.js.map +1 -0
- package/dist/index.d.ts +191 -49
- package/dist/index.js +2149 -1651
- package/dist/index.js.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/vite/index.d.ts +7 -0
- package/dist/vite/index.js +206 -0
- package/dist/vite/index.js.map +1 -0
- package/llms.txt +128 -20
- package/package.json +18 -9
- package/dist/StyleRegistryContext-ButsUd8D.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,50 @@ All notable changes to `@rootnative/web` are in this file. The format follows [K
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.0.0-alpha.2] - 2026-11-11
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`ActivityIndicator`**: a spinner with `animating`, `color` (default `#999999`), `hidesWhenStopped`, and `size` (`small`, `large`, or a number). It has the role `progressbar`.
|
|
12
|
+
- **`Button`**: a `<button type="button">` with the `title`, on `TouchableOpacity`. It has the look of the Android button, `color` sets the background, and the title keeps its case.
|
|
13
|
+
- **`Switch`**: a checkbox input with the role `switch` under a drawn track and thumb, with `value`, `onValueChange`, `onChange`, `trackColor`, `thumbColor`, and `disabled`. It has the look of the Android switch.
|
|
14
|
+
- **`TouchableHighlight`**: shows `underlayColor` (default black) behind its child and gives the child `activeOpacity` (default `0.85`) while pressed, with `onShowUnderlay` and `onHideUnderlay`.
|
|
15
|
+
- **`TouchableNativeFeedback`**: works as on iOS, with no ripple. `SelectableBackground`, `SelectableBackgroundBorderless`, and `Ripple` return the objects of React Native, and `canUseNativeForeground()` is `false`.
|
|
16
|
+
- **`TouchableOpacity`**: dims to `activeOpacity` (default `0.2`) while pressed, with React Native's timing and curve, through the Web Animations API.
|
|
17
|
+
- **`TouchableWithoutFeedback`**: gives its only child the press handlers and its accessibility props, with no element of its own.
|
|
18
|
+
- **`Text` press events:** `onPressIn`, `onPressOut`, `onLongPress`, and `pressRetentionOffset`, on the same press responder as `Pressable`. `suppressHighlighting` is ignored, as on Android.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- A pressable `Text` has the role `link` and is in the tab order, as on native, so Enter and Space press it. A `Text` is pressable with `onPress` or `onLongPress`, and not `disabled`.
|
|
23
|
+
- **Breaking:** `Text` presses as `Pressable` does: `onPress` fires on the pointer release and gets a `GestureResponderEvent`. `preventDefault()` in `onClick` no longer stops `onPress`: both run, `onClick` first.
|
|
24
|
+
- `PressEvent` is now the same type as `GestureResponderEvent`, and it's deprecated.
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
- **`__DEV__` in a production build.** The Vite plugin of `0.0.0-alpha.1` set `__DEV__` to `true` in each build, also in production. It's now `false` in a production build.
|
|
29
|
+
- **Development warnings on a production server.** A server render with `NODE_ENV=production` logged the development warnings. It no longer does.
|
|
30
|
+
|
|
31
|
+
## [0.0.0-alpha.1] - 2026-11-10
|
|
32
|
+
|
|
33
|
+
### Added
|
|
34
|
+
|
|
35
|
+
- **Vite plugin** from `@rootnative/web/vite`. Add `rootnative()` to `plugins` in `vite.config.ts`. It needs Vite 8, an optional peer dependency. The plugin:
|
|
36
|
+
- resolves `react-native` to `@rootnative/web`,
|
|
37
|
+
- resolves `Button.web.tsx` before `Button.tsx`,
|
|
38
|
+
- defines `__DEV__`,
|
|
39
|
+
- puts `'web'` in place of each `Platform.OS` read, so the minifier drops the code of the other platforms.
|
|
40
|
+
- **`__DEV__`**, the React Native global: `true` in a development build, `false` in a production build. The Vite plugin defines it, also for pre-bundled dependencies, and the package types declare it.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- The package README and `llms.txt` set up an app with the Vite plugin.
|
|
45
|
+
|
|
46
|
+
### Notes
|
|
47
|
+
|
|
48
|
+
- The hand-written `react-native` alias from `0.0.0-alpha.0` still works. To use the plugin, remove the alias and add `rootnative()`. [Vite plugin](https://rootnative.github.io/web/vite-plugin) also shows a setup without the plugin.
|
|
49
|
+
- In server rendering, a dependency that Vite leaves to Node gets no `__DEV__` and throws a `ReferenceError`. Add that dependency to `ssr.noExternal`.
|
|
50
|
+
|
|
7
51
|
## [0.0.0-alpha.0] - 2026-11-10
|
|
8
52
|
|
|
9
53
|
The first alpha. It runs a React Native app in the browser with the components and APIs below. [Status](https://rootnative.github.io/web/status) lists what's planned and what's out of scope.
|
|
@@ -25,5 +69,7 @@ The first alpha. It runs a React Native app in the browser with the components a
|
|
|
25
69
|
- There's no Vite plugin yet. Set the `react-native` alias by hand, as [Installation](https://rootnative.github.io/web/installation) shows.
|
|
26
70
|
- The tests run in Chromium. Firefox and Safari aren't in the test run yet.
|
|
27
71
|
|
|
28
|
-
[unreleased]: https://github.com/rootnative/web/compare/web@0.0.0-alpha.
|
|
72
|
+
[unreleased]: https://github.com/rootnative/web/compare/web@0.0.0-alpha.2...HEAD
|
|
73
|
+
[0.0.0-alpha.2]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.2
|
|
74
|
+
[0.0.0-alpha.1]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.1
|
|
29
75
|
[0.0.0-alpha.0]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.0
|
package/README.md
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
# @rootnative/web
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@rootnative/web)
|
|
4
|
+
[](https://github.com/rootnative/web/blob/main/LICENSE)
|
|
5
|
+
|
|
3
6
|
A standalone web runtime for React Native apps. You write `react-native`. It runs in the browser as a real web app, with semantic HTML, atomic CSS, server rendering, and SEO tags.
|
|
4
7
|
|
|
5
|
-
> **Early alpha.** The API can change between releases. [Status](https://rootnative.github.io/web/status) lists what ships today.
|
|
8
|
+
> **Early alpha.** The API can change between releases. [Status](https://rootnative.github.io/web/status) lists what ships today, and the [changelog](https://github.com/rootnative/web/blob/main/packages/web/CHANGELOG.md) lists the changes in each release.
|
|
6
9
|
|
|
7
10
|
**Docs: https://rootnative.github.io/web/**
|
|
8
11
|
|
|
@@ -12,17 +15,15 @@ A standalone web runtime for React Native apps. You write `react-native`. It run
|
|
|
12
15
|
npm install @rootnative/web
|
|
13
16
|
```
|
|
14
17
|
|
|
15
|
-
React 19 and React DOM 19 are peer dependencies.
|
|
18
|
+
React 19 and React DOM 19 are peer dependencies. Add the Vite plugin to `vite.config.ts`. It resolves `react-native` to the package:
|
|
16
19
|
|
|
17
20
|
```ts
|
|
21
|
+
import { rootnative } from '@rootnative/web/vite'
|
|
18
22
|
import react from '@vitejs/plugin-react'
|
|
19
23
|
import { defineConfig } from 'vite'
|
|
20
24
|
|
|
21
25
|
export default defineConfig({
|
|
22
|
-
plugins: [react()],
|
|
23
|
-
resolve: {
|
|
24
|
-
alias: { 'react-native': '@rootnative/web' },
|
|
25
|
-
},
|
|
26
|
+
plugins: [react(), rootnative()],
|
|
26
27
|
})
|
|
27
28
|
```
|
|
28
29
|
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
+
import { t as hasDOM } from "./env-DK5Mt9yX.js";
|
|
1
2
|
import { createContext, useContext } from "react";
|
|
2
|
-
// src/utils/env.ts
|
|
3
|
-
const nodeEnv = () => typeof process !== "undefined" ? "development" : import.meta.env?.MODE;
|
|
4
|
-
const isTestEnv = () => nodeEnv() === "test";
|
|
5
|
-
const isProductionEnv = () => nodeEnv() === "production";
|
|
6
|
-
const hasDOM = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
7
|
-
const matchesMedia = (query) => hasDOM() && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
8
3
|
// src/style/registry.ts
|
|
9
4
|
const SHORTHAND_STYLE_ID = "rootnative-style-shorthand";
|
|
10
5
|
const LONGHAND_STYLE_ID = "rootnative-style-longhand";
|
|
@@ -124,6 +119,6 @@ const domSheet = (id) => {
|
|
|
124
119
|
// src/style/StyleRegistryContext.ts
|
|
125
120
|
const StyleRegistryContext = createContext(null);
|
|
126
121
|
const useStyleRegistry = () => useContext(StyleRegistryContext) ?? getStyleRegistry();
|
|
127
|
-
export { StyleRegistry as a,
|
|
122
|
+
export { StyleRegistry as a, SHORTHAND_STYLE_ID as i, useStyleRegistry as n, getStyleRegistry as o, LONGHAND_STYLE_ID as r, StyleRegistryContext as t };
|
|
128
123
|
|
|
129
|
-
//# sourceMappingURL=StyleRegistryContext-
|
|
124
|
+
//# sourceMappingURL=StyleRegistryContext-CAD45r4n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StyleRegistryContext-CAD45r4n.js","names":[],"sources":["../src/style/registry.ts","../src/style/StyleRegistryContext.ts"],"sourcesContent":["import { hasDOM } from '../utils/env'\nimport type { CSSDeclarations } from './types'\n\n// Two style elements: shorthand rules first, longhand rules after them. With equal\n// specificity the later sheet wins, so a longhand always beats a shorthand, as on native.\nexport const SHORTHAND_STYLE_ID = 'rootnative-style-shorthand'\nexport const LONGHAND_STYLE_ID = 'rootnative-style-longhand'\n\nconst shorthandProperties: ReadonlySet<string> = new Set([\n 'border',\n 'borderBlock',\n 'borderColor',\n 'borderInline',\n 'borderRadius',\n 'borderStyle',\n 'borderWidth',\n 'flex',\n 'flexFlow',\n 'gap',\n 'inset',\n 'insetBlock',\n 'insetInline',\n 'margin',\n 'marginBlock',\n 'marginInline',\n 'outline',\n 'overflow',\n 'padding',\n 'paddingBlock',\n 'paddingInline',\n 'textDecoration',\n])\n\nconst toKebab = (name: string): string => name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)\n\nconst hash = (input: string): string => {\n let h = 0x811c9dc5\n for (let i = 0; i < input.length; i++) {\n h ^= input.charCodeAt(i)\n h = Math.imul(h, 0x01000193)\n }\n return (h >>> 0).toString(36)\n}\n\nexport type StyleSheets = { shorthand: CSSStyleSheet | null; longhand: CSSStyleSheet | null }\n\nexport class StyleRegistry {\n private readonly classNames = new Map<string, string>()\n private readonly adopted = new Set<string>()\n private readonly shorthandRules: string[] = []\n private readonly longhandRules: string[] = []\n private readonly sheets: StyleSheets\n\n constructor(sheets: StyleSheets = { shorthand: null, longhand: null }) {\n this.sheets = sheets\n this.adopt(sheets.shorthand)\n this.adopt(sheets.longhand)\n }\n\n classFor(property: string, value: string): string {\n const key = `${property}:${value}`\n const known = this.classNames.get(key)\n if (known !== undefined) return known\n\n const className = `rn-${hash(key)}`\n this.classNames.set(key, className)\n\n const shorthand = shorthandProperties.has(property)\n const rule = `.${className}{${toKebab(property)}:${value}}`\n const rules = shorthand ? this.shorthandRules : this.longhandRules\n rules.push(rule)\n\n if (!this.adopted.has(className)) {\n const sheet = shorthand ? this.sheets.shorthand : this.sheets.longhand\n sheet?.insertRule(rule, sheet.cssRules.length)\n }\n return className\n }\n\n classesFor(declarations: CSSDeclarations): string {\n const names: string[] = []\n for (const property in declarations) {\n names.push(this.classFor(property, declarations[property] as string))\n }\n return names.join(' ')\n }\n\n // Inserts a fixed set of rules under one class name, once. For rules an atomic\n // declaration cannot express, for example a child selector.\n staticClass(className: string, rules: ReadonlyArray<string>): string {\n if (this.classNames.has(className)) return className\n this.classNames.set(className, className)\n for (const rule of rules) {\n this.longhandRules.push(rule)\n if (!this.adopted.has(className)) {\n const sheet = this.sheets.longhand\n sheet?.insertRule(rule, sheet.cssRules.length)\n }\n }\n return className\n }\n\n // The rules of each sheet, for server rendering.\n cssText(): { shorthand: string; longhand: string } {\n return { shorthand: this.shorthandRules.join('\\n'), longhand: this.longhandRules.join('\\n') }\n }\n\n get ruleCount(): number {\n return this.shorthandRules.length + this.longhandRules.length\n }\n\n // Remembers the class names the server already rendered, so the client does not insert them again.\n private adopt(sheet: CSSStyleSheet | null): void {\n if (sheet === null) return\n for (const rule of Array.from(sheet.cssRules)) {\n if (rule instanceof CSSStyleRule) this.adopted.add(rule.selectorText.slice(1))\n }\n }\n}\n\nlet defaultRegistry: StyleRegistry | null = null\n\nexport const getStyleRegistry = (): StyleRegistry => {\n if (defaultRegistry !== null) return defaultRegistry\n defaultRegistry = new StyleRegistry(\n hasDOM()\n ? { shorthand: domSheet(SHORTHAND_STYLE_ID), longhand: domSheet(LONGHAND_STYLE_ID) }\n : { shorthand: null, longhand: null },\n )\n return defaultRegistry\n}\n\n// For tests, so each file starts with an empty registry.\nexport const resetStyleRegistry = (): void => {\n defaultRegistry = null\n if (!hasDOM()) return\n document.getElementById(SHORTHAND_STYLE_ID)?.remove()\n document.getElementById(LONGHAND_STYLE_ID)?.remove()\n}\n\nconst domSheet = (id: string): CSSStyleSheet => {\n let element = document.getElementById(id) as HTMLStyleElement | null\n if (element === null) {\n element = document.createElement('style')\n element.id = id\n document.head.appendChild(element)\n }\n return element.sheet as CSSStyleSheet\n}\n","import { createContext, useContext, type Context } from 'react'\n\nimport { getStyleRegistry, type StyleRegistry } from './registry'\n\nexport const StyleRegistryContext: Context<StyleRegistry | null> =\n createContext<StyleRegistry | null>(null)\n\nexport const useStyleRegistry = (): StyleRegistry =>\n useContext(StyleRegistryContext) ?? getStyleRegistry()\n"],"mappings":";;;AAKA,MAAa,qBAAqB;AAClC,MAAa,oBAAoB;AAEjC,MAAM,sCAA2C,IAAI,IAAI;CACvD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,MAAM,WAAW,SAAyB,KAAK,QAAQ,WAAW,MAAM,IAAI,EAAE,YAAY,GAAG;AAE7F,MAAM,QAAQ,UAA0B;CACtC,IAAI,IAAI;CACR,KAAK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ined" ? process.env.NODE_ENV : import.meta.env?.MODE;
|
|
3
|
+
const isTestEnv = () => nodeEnv() === "test";
|
|
4
|
+
const isProductionEnv = () => nodeEnv() === "production";
|
|
5
|
+
const hasDOM = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
6
|
+
const matchesMedia = (query) => hasDOM() && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
7
|
+
export { matchesMedia as i, isProductionEnv as n, isTestEnv as r, hasDOM as t };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=env-DK5Mt9yX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-DK5Mt9yX.js","names":[],"sources":["../src/utils/env.ts"],"sourcesContent":["declare const process: { env: { NODE_ENV?: string } } | undefined\n\ndeclare global {\n interface ImportMeta {\n env?: { MODE?: string }\n }\n}\n\nconst nodeEnv = (): string | undefined =>\n typeof process !== 'undefined' ? process.env.NODE_ENV : import.meta.env?.MODE\n\nexport const isTestEnv = (): boolean => nodeEnv() === 'test'\n\nexport const isProductionEnv = (): boolean => nodeEnv() === 'production'\n\nexport const hasDOM = (): boolean =>\n typeof window !== 'undefined' && typeof document !== 'undefined'\n\nexport const matchesMedia = (query: string): boolean =>\n hasDOM() && typeof window.matchMedia === 'function' && window.matchMedia(query).matches\n"],"mappings":";AAQA,MAAM,gBACJ,OAAO,YAAY,cAAA,QAAA,IAAA,WAAqC,YAAY,KAAK;AAE3E,MAAa,kBAA2B,QAAQ,MAAM;AAEtD,MAAa,wBAAiC,QAAQ,MAAM;AAE5D,MAAa,eACX,OAAO,WAAW,eAAe,OAAO,aAAa;AAEvD,MAAa,gBAAgB,UAC3B,OAAO,KAAK,OAAO,OAAO,eAAe,cAAc,OAAO,WAAW,KAAK,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as FlatStyle, r as StyleProp } from "./types-BxTWbdj9.js";
|
|
2
|
-
import { BaseSyntheticEvent, ComponentType, Context, DOMAttributes, FocusEvent as FocusEvent$1, HTMLAttributeReferrerPolicy, KeyboardEvent, MouseEvent as MouseEvent$1, NamedExoticComponent, PointerEvent, ReactElement, ReactNode, Ref
|
|
2
|
+
import { BaseSyntheticEvent, ComponentType, Context, DOMAttributes, FocusEvent as FocusEvent$1, HTMLAttributeReferrerPolicy, KeyboardEvent, MouseEvent as MouseEvent$1, NamedExoticComponent, PointerEvent, ReactElement, ReactNode, Ref } from "react";
|
|
3
3
|
type AccessibilityChangeEventName = "change" | "boldTextChanged" | "grayscaleChanged" | "invertColorsChanged" | "reduceMotionChanged" | "reduceTransparencyChanged" | "highTextContrastChanged" | "darkerSystemColorsChanged" | "screenReaderChanged" | "announcementFinished";
|
|
4
4
|
type AccessibilityChangeEvent = boolean;
|
|
5
5
|
type AccessibilityAnnouncementFinishedEvent = {
|
|
@@ -276,6 +276,118 @@ type ViewProps = AccessibilityProps & DOMEventHandlers<HTMLElement> & {
|
|
|
276
276
|
"aria-level"?: number | undefined;
|
|
277
277
|
href?: string | undefined;
|
|
278
278
|
};
|
|
279
|
+
type ActivityIndicatorProps = ViewProps & {
|
|
280
|
+
animating?: boolean | undefined;
|
|
281
|
+
color?: string | undefined;
|
|
282
|
+
hidesWhenStopped?: boolean | undefined;
|
|
283
|
+
size?: number | "small" | "large" | undefined;
|
|
284
|
+
};
|
|
285
|
+
export declare function ActivityIndicator(props: ActivityIndicatorProps): ReactElement;
|
|
286
|
+
type Rect = Readonly<{
|
|
287
|
+
bottom?: number | undefined;
|
|
288
|
+
left?: number | undefined;
|
|
289
|
+
right?: number | undefined;
|
|
290
|
+
top?: number | undefined;
|
|
291
|
+
}>;
|
|
292
|
+
type Insets = Rect;
|
|
293
|
+
type RectOrSize = Rect | number;
|
|
294
|
+
type PressabilityConfig = Readonly<{
|
|
295
|
+
cancelable?: boolean | undefined;
|
|
296
|
+
disabled?: boolean | undefined;
|
|
297
|
+
hitSlop?: RectOrSize | undefined;
|
|
298
|
+
pressRectOffset?: RectOrSize | undefined;
|
|
299
|
+
android_disableSound?: boolean | undefined;
|
|
300
|
+
delayHoverIn?: number | undefined;
|
|
301
|
+
delayHoverOut?: number | undefined;
|
|
302
|
+
delayLongPress?: number | undefined;
|
|
303
|
+
delayPressIn?: number | undefined;
|
|
304
|
+
delayPressOut?: number | undefined;
|
|
305
|
+
minPressDuration?: number | undefined;
|
|
306
|
+
onBlur?: ((event: BlurEvent) => unknown) | undefined;
|
|
307
|
+
onFocus?: ((event: FocusEvent) => unknown) | undefined;
|
|
308
|
+
onHoverIn?: ((event: MouseEvent) => unknown) | undefined;
|
|
309
|
+
onHoverOut?: ((event: MouseEvent) => unknown) | undefined;
|
|
310
|
+
onLongPress?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
311
|
+
onPress?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
312
|
+
onPressIn?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
313
|
+
onPressMove?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
314
|
+
onPressOut?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
315
|
+
blockNativeResponder?: boolean | undefined;
|
|
316
|
+
}>;
|
|
317
|
+
type PressabilityEventHandlers = Readonly<{
|
|
318
|
+
onBlur: (event: FocusEvent$1<HTMLElement>) => void;
|
|
319
|
+
onClick: (event: MouseEvent$1<HTMLElement>) => void;
|
|
320
|
+
onContextMenu: (event: MouseEvent$1<HTMLElement>) => void;
|
|
321
|
+
onFocus: (event: FocusEvent$1<HTMLElement>) => void;
|
|
322
|
+
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
323
|
+
onKeyUp: (event: KeyboardEvent<HTMLElement>) => void;
|
|
324
|
+
onPointerCancel: (event: PointerEvent<HTMLElement>) => void;
|
|
325
|
+
onPointerDown: (event: PointerEvent<HTMLElement>) => void;
|
|
326
|
+
onPointerEnter: (event: PointerEvent<HTMLElement>) => void;
|
|
327
|
+
onPointerLeave: (event: PointerEvent<HTMLElement>) => void;
|
|
328
|
+
onPointerMove: (event: PointerEvent<HTMLElement>) => void;
|
|
329
|
+
onPointerUp: (event: PointerEvent<HTMLElement>) => void;
|
|
330
|
+
}>;
|
|
331
|
+
type TouchablePressProps = {
|
|
332
|
+
delayLongPress?: number | undefined;
|
|
333
|
+
delayPressIn?: number | undefined;
|
|
334
|
+
delayPressOut?: number | undefined;
|
|
335
|
+
disabled?: boolean | undefined;
|
|
336
|
+
hitSlop?: RectOrSize | undefined;
|
|
337
|
+
onBlur?: ((event: BlurEvent) => unknown) | undefined;
|
|
338
|
+
onFocus?: ((event: FocusEvent) => unknown) | undefined;
|
|
339
|
+
onLongPress?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
340
|
+
onPress?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
341
|
+
onPressIn?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
342
|
+
onPressOut?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
343
|
+
pressRetentionOffset?: RectOrSize | undefined;
|
|
344
|
+
rejectResponderTermination?: boolean | undefined;
|
|
345
|
+
touchSoundDisabled?: boolean | undefined;
|
|
346
|
+
};
|
|
347
|
+
type TouchableTVProps = {
|
|
348
|
+
hasTVPreferredFocus?: boolean | undefined;
|
|
349
|
+
nextFocusDown?: number | undefined;
|
|
350
|
+
nextFocusForward?: number | undefined;
|
|
351
|
+
nextFocusLeft?: number | undefined;
|
|
352
|
+
nextFocusRight?: number | undefined;
|
|
353
|
+
nextFocusUp?: number | undefined;
|
|
354
|
+
};
|
|
355
|
+
type TouchableWithoutFeedbackProps = AccessibilityProps & TouchablePressProps & {
|
|
356
|
+
children?: ReactNode | undefined;
|
|
357
|
+
focusable?: boolean | undefined;
|
|
358
|
+
id?: string | undefined;
|
|
359
|
+
nativeID?: string | undefined;
|
|
360
|
+
testID?: string | undefined;
|
|
361
|
+
onLayout?: ((event: LayoutChangeEvent) => unknown) | undefined;
|
|
362
|
+
style?: StyleProp<Record<string, unknown>> | undefined;
|
|
363
|
+
};
|
|
364
|
+
type ButtonProps = TouchableTVProps & {
|
|
365
|
+
title: string;
|
|
366
|
+
onPress?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
367
|
+
color?: string | undefined;
|
|
368
|
+
disabled?: boolean | undefined;
|
|
369
|
+
testID?: string | undefined;
|
|
370
|
+
ref?: Ref<HTMLElement> | undefined;
|
|
371
|
+
accessible?: boolean | undefined;
|
|
372
|
+
accessibilityLabel?: string | undefined;
|
|
373
|
+
accessibilityHint?: string | undefined;
|
|
374
|
+
accessibilityLanguage?: string | undefined;
|
|
375
|
+
accessibilityState?: AccessibilityState | undefined;
|
|
376
|
+
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
377
|
+
"aria-busy"?: boolean | undefined;
|
|
378
|
+
"aria-checked"?: boolean | "mixed" | undefined;
|
|
379
|
+
"aria-disabled"?: boolean | undefined;
|
|
380
|
+
"aria-expanded"?: boolean | undefined;
|
|
381
|
+
"aria-label"?: string | undefined;
|
|
382
|
+
"aria-selected"?: boolean | undefined;
|
|
383
|
+
accessibilityActions?: ReadonlyArray<{
|
|
384
|
+
name: string;
|
|
385
|
+
label?: string | undefined;
|
|
386
|
+
}> | undefined;
|
|
387
|
+
onAccessibilityAction?: ((event: unknown) => unknown) | undefined;
|
|
388
|
+
touchSoundDisabled?: boolean | undefined;
|
|
389
|
+
};
|
|
390
|
+
export declare function Button(props: ButtonProps): ReactElement;
|
|
279
391
|
type NativeScrollPoint = {
|
|
280
392
|
x: number;
|
|
281
393
|
y: number;
|
|
@@ -608,51 +720,6 @@ type ImageStatics = {
|
|
|
608
720
|
};
|
|
609
721
|
declare function ImageComponent(props: ImageProps): ReactElement;
|
|
610
722
|
export declare const Image: typeof ImageComponent & ImageStatics;
|
|
611
|
-
type Rect = Readonly<{
|
|
612
|
-
bottom?: number | undefined;
|
|
613
|
-
left?: number | undefined;
|
|
614
|
-
right?: number | undefined;
|
|
615
|
-
top?: number | undefined;
|
|
616
|
-
}>;
|
|
617
|
-
type Insets = Rect;
|
|
618
|
-
type RectOrSize = Rect | number;
|
|
619
|
-
type PressabilityConfig = Readonly<{
|
|
620
|
-
cancelable?: boolean | undefined;
|
|
621
|
-
disabled?: boolean | undefined;
|
|
622
|
-
hitSlop?: RectOrSize | undefined;
|
|
623
|
-
pressRectOffset?: RectOrSize | undefined;
|
|
624
|
-
android_disableSound?: boolean | undefined;
|
|
625
|
-
delayHoverIn?: number | undefined;
|
|
626
|
-
delayHoverOut?: number | undefined;
|
|
627
|
-
delayLongPress?: number | undefined;
|
|
628
|
-
delayPressIn?: number | undefined;
|
|
629
|
-
delayPressOut?: number | undefined;
|
|
630
|
-
minPressDuration?: number | undefined;
|
|
631
|
-
onBlur?: ((event: BlurEvent) => unknown) | undefined;
|
|
632
|
-
onFocus?: ((event: FocusEvent) => unknown) | undefined;
|
|
633
|
-
onHoverIn?: ((event: MouseEvent) => unknown) | undefined;
|
|
634
|
-
onHoverOut?: ((event: MouseEvent) => unknown) | undefined;
|
|
635
|
-
onLongPress?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
636
|
-
onPress?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
637
|
-
onPressIn?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
638
|
-
onPressMove?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
639
|
-
onPressOut?: ((event: GestureResponderEvent) => unknown) | undefined;
|
|
640
|
-
blockNativeResponder?: boolean | undefined;
|
|
641
|
-
}>;
|
|
642
|
-
type PressabilityEventHandlers = Readonly<{
|
|
643
|
-
onBlur: (event: FocusEvent$1<HTMLElement>) => void;
|
|
644
|
-
onClick: (event: MouseEvent$1<HTMLElement>) => void;
|
|
645
|
-
onContextMenu: (event: MouseEvent$1<HTMLElement>) => void;
|
|
646
|
-
onFocus: (event: FocusEvent$1<HTMLElement>) => void;
|
|
647
|
-
onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
|
|
648
|
-
onKeyUp: (event: KeyboardEvent<HTMLElement>) => void;
|
|
649
|
-
onPointerCancel: (event: PointerEvent<HTMLElement>) => void;
|
|
650
|
-
onPointerDown: (event: PointerEvent<HTMLElement>) => void;
|
|
651
|
-
onPointerEnter: (event: PointerEvent<HTMLElement>) => void;
|
|
652
|
-
onPointerLeave: (event: PointerEvent<HTMLElement>) => void;
|
|
653
|
-
onPointerMove: (event: PointerEvent<HTMLElement>) => void;
|
|
654
|
-
onPointerUp: (event: PointerEvent<HTMLElement>) => void;
|
|
655
|
-
}>;
|
|
656
723
|
interface PressableStateCallbackType {
|
|
657
724
|
readonly pressed: boolean;
|
|
658
725
|
readonly hovered: boolean;
|
|
@@ -717,7 +784,30 @@ type StatusBarStatics = {
|
|
|
717
784
|
replaceStackEntry: (entry: StatusBarProps, props: StatusBarProps) => StatusBarProps;
|
|
718
785
|
};
|
|
719
786
|
export declare const StatusBar: typeof StatusBarComponent & StatusBarStatics;
|
|
720
|
-
type
|
|
787
|
+
type SwitchChangeEventData = {
|
|
788
|
+
value: boolean;
|
|
789
|
+
target: EventTarget | null;
|
|
790
|
+
};
|
|
791
|
+
type SwitchChangeEvent = NativeSyntheticEvent<SwitchChangeEventData>;
|
|
792
|
+
type SwitchProps = Omit<ViewProps, "children" | "onChange" | "ref"> & {
|
|
793
|
+
ref?: Ref<HTMLInputElement> | undefined;
|
|
794
|
+
value?: boolean | undefined;
|
|
795
|
+
disabled?: boolean | undefined;
|
|
796
|
+
onChange?: ((event: SwitchChangeEvent) => unknown) | undefined;
|
|
797
|
+
onValueChange?: ((value: boolean) => unknown) | undefined;
|
|
798
|
+
thumbColor?: string | undefined;
|
|
799
|
+
trackColor?: Readonly<{
|
|
800
|
+
false?: string | null | undefined;
|
|
801
|
+
true?: string | null | undefined;
|
|
802
|
+
}> | undefined;
|
|
803
|
+
ios_backgroundColor?: string | undefined;
|
|
804
|
+
onTintColor?: string | undefined;
|
|
805
|
+
thumbTintColor?: string | undefined;
|
|
806
|
+
tintColor?: string | undefined;
|
|
807
|
+
};
|
|
808
|
+
export declare function Switch(props: SwitchProps): ReactElement;
|
|
809
|
+
/** @deprecated Use `GestureResponderEvent`, the type that React Native gives `onPress`. */
|
|
810
|
+
type PressEvent = GestureResponderEvent;
|
|
721
811
|
type TextProps = AccessibilityProps & DOMEventHandlers<HTMLElement> & {
|
|
722
812
|
children?: ReactNode;
|
|
723
813
|
style?: StyleProp<Record<string, unknown>> | undefined;
|
|
@@ -732,7 +822,12 @@ type TextProps = AccessibilityProps & DOMEventHandlers<HTMLElement> & {
|
|
|
732
822
|
selectable?: boolean | undefined;
|
|
733
823
|
selectionColor?: string | undefined;
|
|
734
824
|
pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
|
|
735
|
-
onPress?: ((event:
|
|
825
|
+
onPress?: ((event: GestureResponderEvent) => void) | undefined;
|
|
826
|
+
onPressIn?: ((event: GestureResponderEvent) => void) | undefined;
|
|
827
|
+
onPressOut?: ((event: GestureResponderEvent) => void) | undefined;
|
|
828
|
+
onLongPress?: ((event: GestureResponderEvent) => void) | undefined;
|
|
829
|
+
pressRetentionOffset?: RectOrSize | undefined;
|
|
830
|
+
suppressHighlighting?: boolean | undefined;
|
|
736
831
|
onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
|
|
737
832
|
"aria-level"?: number | undefined;
|
|
738
833
|
href?: string | undefined;
|
|
@@ -868,8 +963,55 @@ declare function TextInputComponent(props: TextInputProps): ReactElement;
|
|
|
868
963
|
export declare const TextInput: typeof TextInputComponent & {
|
|
869
964
|
State: TextInputState;
|
|
870
965
|
};
|
|
966
|
+
type TouchableHighlightProps = Omit<ViewProps, "children" | "style" | "onBlur" | "onFocus"> & TouchablePressProps & TouchableTVProps & {
|
|
967
|
+
children?: ReactNode | undefined;
|
|
968
|
+
style?: StyleProp<Record<string, unknown>> | undefined;
|
|
969
|
+
activeOpacity?: number | undefined;
|
|
970
|
+
underlayColor?: string | undefined;
|
|
971
|
+
onShowUnderlay?: (() => void) | undefined;
|
|
972
|
+
onHideUnderlay?: (() => void) | undefined;
|
|
973
|
+
testOnly_pressed?: boolean | undefined;
|
|
974
|
+
};
|
|
975
|
+
export declare function TouchableHighlight(props: TouchableHighlightProps): ReactElement;
|
|
976
|
+
type ThemeAttributeBackgroundPropType = Readonly<{
|
|
977
|
+
type: "ThemeAttrAndroid";
|
|
978
|
+
attribute: "selectableItemBackground" | "selectableItemBackgroundBorderless";
|
|
979
|
+
rippleRadius: number | null | undefined;
|
|
980
|
+
}>;
|
|
981
|
+
type RippleBackgroundPropType = Readonly<{
|
|
982
|
+
type: "RippleAndroid";
|
|
983
|
+
color: ProcessedColorValue | null | undefined;
|
|
984
|
+
borderless: boolean;
|
|
985
|
+
rippleRadius: number | null | undefined;
|
|
986
|
+
}>;
|
|
987
|
+
type BackgroundPropType = ThemeAttributeBackgroundPropType | RippleBackgroundPropType;
|
|
988
|
+
type TouchableNativeFeedbackProps = TouchableWithoutFeedbackProps & TouchableTVProps & {
|
|
989
|
+
background?: BackgroundPropType | undefined;
|
|
990
|
+
useForeground?: boolean | undefined;
|
|
991
|
+
};
|
|
992
|
+
type TouchableNativeFeedbackStatics = {
|
|
993
|
+
SelectableBackground: (rippleRadius?: number | null) => ThemeAttributeBackgroundPropType;
|
|
994
|
+
SelectableBackgroundBorderless: (rippleRadius?: number | null) => ThemeAttributeBackgroundPropType;
|
|
995
|
+
Ripple: (color: string, borderless: boolean, rippleRadius?: number | null) => RippleBackgroundPropType;
|
|
996
|
+
canUseNativeForeground: () => boolean;
|
|
997
|
+
};
|
|
998
|
+
export declare const TouchableNativeFeedback: ((props: TouchableNativeFeedbackProps) => ReactElement) & TouchableNativeFeedbackStatics;
|
|
999
|
+
type TouchableOpacityProps = Omit<ViewProps, "children" | "style" | "onBlur" | "onFocus"> & TouchablePressProps & TouchableTVProps & {
|
|
1000
|
+
children?: ReactNode | undefined;
|
|
1001
|
+
style?: StyleProp<Record<string, unknown>> | undefined;
|
|
1002
|
+
activeOpacity?: number | undefined;
|
|
1003
|
+
};
|
|
1004
|
+
export declare function TouchableOpacity(props: TouchableOpacityProps): ReactElement;
|
|
1005
|
+
export declare function TouchableWithoutFeedback(props: TouchableWithoutFeedbackProps): ReactElement;
|
|
871
1006
|
export declare function View(props: ViewProps): ReactElement;
|
|
872
1007
|
export declare function usePressability(config: PressabilityConfig): PressabilityEventHandlers;
|
|
873
1008
|
export declare function usePressability(config: PressabilityConfig | null | undefined): PressabilityEventHandlers | null;
|
|
874
|
-
|
|
1009
|
+
declare global {
|
|
1010
|
+
/**
|
|
1011
|
+
* `true` in a development build and `false` in a production build, as in React Native. The
|
|
1012
|
+
* bundler sets it: the plugin from `@rootnative/web/vite` does, or a `define` in your config.
|
|
1013
|
+
*/
|
|
1014
|
+
const __DEV__: boolean;
|
|
1015
|
+
}
|
|
1016
|
+
export type { AbsoluteFillStyle, AccessibilityAnnouncementFinishedEvent, AccessibilityChangeEvent, AccessibilityChangeEventName, AccessibilityEventSubscription, AccessibilityProps, AccessibilityState, AccessibilityValue, ActivityIndicatorProps, AppearanceListener, AppearancePreferences, BackHandlerSubscription, BackPressHandler, BlurEvent, ButtonProps, CellRendererProps, ColorSchemeName, DOMEventHandlers, DimensionsChangeHandler, DimensionsValue, EmitterSubscription, EnterKeyHint, FlatListInstance, FlatListProps, FocusEvent, GestureResponderEvent, GestureResponderHandlers, I18nManagerConstants, ImageErrorEvent, ImageLoadEvent, ImageLoadEventData, ImageProgressEvent, ImageProps, ImageResizeMode, ImageResolvedAssetSource, ImageSize, ImageSource, ImageStatics, ImageURISource, InputMode, Insets, KeyboardType, LayoutChangeEvent, LayoutRectangle, ListRenderItem, ListRenderItemInfo, ListSeparatorComponent, ListSeparatorProps, ListSeparators, MouseEvent, NativeEventSubscription, NativeScrollEvent, NativeScrollPoint, NativeScrollRectangle, NativeScrollSize, NativeSyntheticEvent, NativeTouchEvent, PanResponderCallbacks, PanResponderGestureState, PanResponderInstance, PlatformOSType, PlatformSelectSpec, PlatformType, PressEvent, PressabilityConfig, PressabilityEventHandlers, PressableAndroidRippleConfig, PressableInstance, PressableProps, PressableStateCallbackType, ProcessedColorValue, ReturnKeyType, Role, ScaledSize, ScrollEvent, ScrollToIndexParams, ScrollToItemParams, ScrollToOffsetParams, ScrollToOptions, ScrollViewInstance, ScrollViewProps, StatusBarAnimation, StatusBarProps, StatusBarStatics, StatusBarStyle, StyleProp, SubmitBehavior, SwitchChangeEvent, SwitchChangeEventData, SwitchProps, TextInputChangeEvent, TextInputChangeEventData, TextInputContentSizeChangeEvent, TextInputEndEditingEvent, TextInputFocusEvent, TextInputInstance, TextInputKeyPressEvent, TextInputProps, TextInputScrollEvent, TextInputSelection, TextInputSelectionChangeEvent, TextInputState, TextInputSubmitEditingEvent, TextProps, TouchableHighlightProps, TouchableNativeFeedbackProps, TouchableOpacityProps, TouchableWithoutFeedbackProps, ViewProps, ViewToken, ViewabilityConfig, ViewabilityConfigCallbackPair, ViewabilityConfigCallbackPairs, ViewableItemsChangedInfo };
|
|
875
1017
|
//# sourceMappingURL=index.d.ts.map
|