@rootnative/web 0.0.0-alpha.1 → 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 +26 -1
- package/dist/{StyleRegistryContext-D6yDrZk0.js → StyleRegistryContext-CAD45r4n.js} +2 -2
- package/dist/{StyleRegistryContext-D6yDrZk0.js.map → StyleRegistryContext-CAD45r4n.js.map} +1 -1
- package/dist/{env-BQE0B2yw.js → env-DK5Mt9yX.js} +2 -2
- package/dist/{env-BQE0B2yw.js.map → env-DK5Mt9yX.js.map} +1 -1
- package/dist/index.d.ts +184 -49
- package/dist/index.js +2149 -1652
- package/dist/index.js.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/vite/index.js +1 -1
- package/llms.txt +99 -11
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ 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
|
+
|
|
7
31
|
## [0.0.0-alpha.1] - 2026-11-10
|
|
8
32
|
|
|
9
33
|
### Added
|
|
@@ -45,6 +69,7 @@ The first alpha. It runs a React Native app in the browser with the components a
|
|
|
45
69
|
- There's no Vite plugin yet. Set the `react-native` alias by hand, as [Installation](https://rootnative.github.io/web/installation) shows.
|
|
46
70
|
- The tests run in Chromium. Firefox and Safari aren't in the test run yet.
|
|
47
71
|
|
|
48
|
-
[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
|
|
49
74
|
[0.0.0-alpha.1]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.1
|
|
50
75
|
[0.0.0-alpha.0]: https://github.com/rootnative/web/releases/tag/web@0.0.0-alpha.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as hasDOM } from "./env-
|
|
1
|
+
import { t as hasDOM } from "./env-DK5Mt9yX.js";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
// src/style/registry.ts
|
|
4
4
|
const SHORTHAND_STYLE_ID = "rootnative-style-shorthand";
|
|
@@ -121,4 +121,4 @@ const StyleRegistryContext = createContext(null);
|
|
|
121
121
|
const useStyleRegistry = () => useContext(StyleRegistryContext) ?? getStyleRegistry();
|
|
122
122
|
export { StyleRegistry as a, SHORTHAND_STYLE_ID as i, useStyleRegistry as n, getStyleRegistry as o, LONGHAND_STYLE_ID as r, StyleRegistryContext as t };
|
|
123
123
|
|
|
124
|
-
//# sourceMappingURL=StyleRegistryContext-
|
|
124
|
+
//# sourceMappingURL=StyleRegistryContext-CAD45r4n.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StyleRegistryContext-
|
|
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;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,IAAI;AAE1C,MAAa,yBACX,WAAW,oBAAoB,KAAK,iBAAiB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/utils/env.ts
|
|
2
|
-
const nodeEnv = () => typeof process !== "undefined" ?
|
|
2
|
+
const nodeEnv = () => typeof process !== "undefined" ? process.env.NODE_ENV : import.meta.env?.MODE;
|
|
3
3
|
const isTestEnv = () => nodeEnv() === "test";
|
|
4
4
|
const isProductionEnv = () => nodeEnv() === "production";
|
|
5
5
|
const hasDOM = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
6
6
|
const matchesMedia = (query) => hasDOM() && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
7
7
|
export { matchesMedia as i, isProductionEnv as n, isTestEnv as r, hasDOM as t };
|
|
8
8
|
|
|
9
|
-
//# sourceMappingURL=env-
|
|
9
|
+
//# sourceMappingURL=env-DK5Mt9yX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-
|
|
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,6 +963,46 @@ 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;
|
|
@@ -878,5 +1013,5 @@ declare global {
|
|
|
878
1013
|
*/
|
|
879
1014
|
const __DEV__: boolean;
|
|
880
1015
|
}
|
|
881
|
-
export type { AbsoluteFillStyle, AccessibilityAnnouncementFinishedEvent, AccessibilityChangeEvent, AccessibilityChangeEventName, AccessibilityEventSubscription, AccessibilityProps, AccessibilityState, AccessibilityValue, AppearanceListener, AppearancePreferences, BackHandlerSubscription, BackPressHandler, BlurEvent, 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, TextInputChangeEvent, TextInputChangeEventData, TextInputContentSizeChangeEvent, TextInputEndEditingEvent, TextInputFocusEvent, TextInputInstance, TextInputKeyPressEvent, TextInputProps, TextInputScrollEvent, TextInputSelection, TextInputSelectionChangeEvent, TextInputState, TextInputSubmitEditingEvent, TextProps, ViewProps, ViewToken, ViewabilityConfig, ViewabilityConfigCallbackPair, ViewabilityConfigCallbackPairs, ViewableItemsChangedInfo };
|
|
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 };
|
|
882
1017
|
//# sourceMappingURL=index.d.ts.map
|