UNPKG

347 kBTypeScriptView Raw
1// Type definitions for react-native 0.67
2// Project: https://github.com/facebook/react-native
3// Definitions by: Eloy Durán <https://github.com/alloy>
4// HuHuanming <https://github.com/huhuanming>
5// Kyle Roach <https://github.com/iRoachie>
6// Tim Wang <https://github.com/timwangdev>
7// Kamal Mahyuddin <https://github.com/kamal>
8// Alex Dunne <https://github.com/alexdunne>
9// Manuel Alabor <https://github.com/swissmanu>
10// Michele Bombardi <https://github.com/bm-software>
11// Martin van Dam <https://github.com/mvdam>
12// Kacper Wiszczuk <https://github.com/esemesek>
13// Ryan Nickel <https://github.com/mrnickel>
14// Souvik Ghosh <https://github.com/souvik-ghosh>
15// Cheng Gibson <https://github.com/nossbigg>
16// Saransh Kataria <https://github.com/saranshkataria>
17// Wojciech Tyczynski <https://github.com/tykus160>
18// Jake Bloom <https://github.com/jakebloom>
19// Ceyhun Ozugur <https://github.com/ceyhun>
20// Mike Martin <https://github.com/mcmar>
21// Theo Henry de Villeneuve <https://github.com/theohdv>
22// Romain Faust <https://github.com/romain-faust>
23// Be Birchall <https://github.com/bebebebebe>
24// Jesse Katsumata <https://github.com/Naturalclar>
25// Xianming Zhong <https://github.com/chinesedfan>
26// Valentyn Tolochko <https://github.com/vtolochk>
27// Sergey Sychev <https://github.com/SychevSP>
28// Kelvin Chu <https://github.com/RageBill>
29// Daiki Ihara <https://github.com/sasurau4>
30// Abe Dolinger <https://github.com/256hz>
31// Dominique Richard <https://github.com/doumart>
32// Mohamed Shaban <https://github.com/drmas>
33// Jérémy Barbet <https://github.com/jeremybarbet>
34// David Sheldrick <https://github.com/ds300>
35// Natsathorn Yuthakovit <https://github.com/natsathorn>
36// ConnectDotz <https://github.com/connectdotz>
37// Marcel Lasaj <https://github.com/TheWirv>
38// Alexey Molchan <https://github.com/alexeymolchan>
39// Alex Brazier <https://github.com/alexbrazier>
40// Arafat Zahan <https://github.com/kuasha420>
41// Pedro Hernández <https://github.com/phvillegas>
42// Sebastian Silbermann <https://github.com/eps1lon>
43// Zihan Chen <https://github.com/ZihanChen-MSFT>
44// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
45// TypeScript Version: 3.0
46
47///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
48//
49// USING: these definitions are meant to be used with the TSC compiler target set to at least ES2015.
50//
51// USAGE EXAMPLES: check the RNTSExplorer project at https://github.com/bgrieder/RNTSExplorer
52//
53// CONTRIBUTING: please open pull requests
54//
55// CREDITS: This work is based on an original work made by Bernd Paradies: https://github.com/bparadie
56//
57///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
58
59/// <reference path="globals.d.ts" />
60/// <reference path="legacy-properties.d.ts" />
61/// <reference path="BatchedBridge.d.ts" />
62/// <reference path="Devtools.d.ts" />
63/// <reference path="LaunchScreen.d.ts" />
64
65import * as React from 'react';
66
67type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
68
69type Constructor<T> = new (...args: any[]) => T;
70
71export type MeasureOnSuccessCallback = (
72 x: number,
73 y: number,
74 width: number,
75 height: number,
76 pageX: number,
77 pageY: number,
78) => void;
79
80export type MeasureInWindowOnSuccessCallback = (x: number, y: number, width: number, height: number) => void;
81
82export type MeasureLayoutOnSuccessCallback = (left: number, top: number, width: number, height: number) => void;
83
84/**
85 * EventSubscription represents a subscription to a particular event. It can
86 * remove its own subscription.
87 */
88interface EventSubscription {
89 eventType: string;
90 key: number;
91 subscriber: EventSubscriptionVendor;
92
93 /**
94 * @param subscriber the subscriber that controls
95 * this subscription.
96 */
97 new (subscriber: EventSubscriptionVendor): EventSubscription;
98
99 /**
100 * Removes this subscription from the subscriber that controls it.
101 */
102 remove(): void;
103}
104
105/**
106 * EventSubscriptionVendor stores a set of EventSubscriptions that are
107 * subscribed to a particular event type.
108 */
109declare class EventSubscriptionVendor {
110 constructor();
111
112 /**
113 * Adds a subscription keyed by an event type.
114 *
115 */
116 addSubscription(eventType: string, subscription: EventSubscription): EventSubscription;
117
118 /**
119 * Removes a bulk set of the subscriptions.
120 *
121 * @param eventType - Optional name of the event type whose
122 * registered supscriptions to remove, if null remove all subscriptions.
123 */
124 removeAllSubscriptions(eventType?: string): void;
125
126 /**
127 * Removes a specific subscription. Instead of calling this function, call
128 * `subscription.remove()` directly.
129 *
130 */
131 removeSubscription(subscription: any): void;
132
133 /**
134 * Returns the array of subscriptions that are currently registered for the
135 * given event type.
136 *
137 * Note: This array can be potentially sparse as subscriptions are deleted
138 * from it when they are removed.
139 *
140 */
141 getSubscriptionsForType(eventType: string): EventSubscription[];
142}
143
144/**
145 * EmitterSubscription represents a subscription with listener and context data.
146 */
147interface EmitterSubscription extends EventSubscription {
148 emitter: EventEmitter;
149 listener: () => any;
150 context: any;
151
152 /**
153 * @param emitter - The event emitter that registered this
154 * subscription
155 * @param subscriber - The subscriber that controls
156 * this subscription
157 * @param listener - Function to invoke when the specified event is
158 * emitted
159 * @param context - Optional context object to use when invoking the
160 * listener
161 */
162 new (
163 emitter: EventEmitter,
164 subscriber: EventSubscriptionVendor,
165 listener: () => any,
166 context: any,
167 ): EmitterSubscription;
168
169 /**
170 * Removes this subscription from the emitter that registered it.
171 * Note: we're overriding the `remove()` method of EventSubscription here
172 * but deliberately not calling `super.remove()` as the responsibility
173 * for removing the subscription lies with the EventEmitter.
174 */
175 remove(): void;
176}
177
178declare class EventEmitter {
179 /**
180 *
181 * @param subscriber - Optional subscriber instance
182 * to use. If omitted, a new subscriber will be created for the emitter.
183 */
184 constructor(subscriber?: EventSubscriptionVendor | null);
185
186 /**
187 * Adds a listener to be invoked when events of the specified type are
188 * emitted. An optional calling context may be provided. The data arguments
189 * emitted will be passed to the listener function.
190 *
191 * @param eventType - Name of the event to listen to
192 * @param listener - Function to invoke when the specified event is
193 * emitted
194 * @param context - Optional context object to use when invoking the
195 * listener
196 */
197 addListener(eventType: string, listener: (...args: any[]) => any, context?: any): EmitterSubscription;
198
199 /**
200 * Removes all of the registered listeners, including those registered as
201 * listener maps.
202 *
203 * @param eventType - Optional name of the event whose registered
204 * listeners to remove
205 */
206 removeAllListeners(eventType?: string): void;
207
208 /**
209 * Removes a specific subscription. Called by the `remove()` method of the
210 * subscription itself to ensure any necessary cleanup is performed.
211 * @deprecated Use `remove` on the EventSubscription from `addListener`.
212 */
213 removeSubscription(subscription: EmitterSubscription): void;
214
215 /**
216 * Returns the number of listeners that are currently registered for the given
217 * event.
218 *
219 * @param eventType - Name of the event to query
220 */
221 listenerCount(eventType: string): number;
222
223 /**
224 * Emits an event of the given type with the given data. All handlers of that
225 * particular type will be notified.
226 *
227 * @param eventType - Name of the event to emit
228 * @param Arbitrary arguments to be passed to each registered listener
229 *
230 * @example
231 * emitter.addListener('someEvent', function(message) {
232 * console.log(message);
233 * });
234 *
235 * emitter.emit('someEvent', 'abc'); // logs 'abc'
236 */
237 emit(eventType: string, ...params: any[]): void;
238
239 /**
240 * Removes the given listener for event of specific type.
241 *
242 * @param eventType - Name of the event to emit
243 * @param listener - Function to invoke when the specified event is
244 * emitted
245 *
246 * @example
247 * emitter.removeListener('someEvent', function(message) {
248 * console.log(message);
249 * }); // removes the listener if already registered
250 * @deprecated Use `remove` on the EventSubscription from `addListener`.
251 */
252 removeListener(eventType: string, listener: (...args: any[]) => any): void;
253}
254
255/**
256 * NativeMethods provides methods to access the underlying native component directly.
257 * This can be useful in cases when you want to focus a view or measure its on-screen dimensions,
258 * for example.
259 * The methods described here are available on most of the default components provided by React Native.
260 * Note, however, that they are not available on composite components that aren't directly backed by a
261 * native view. This will generally include most components that you define in your own app.
262 * For more information, see [Direct Manipulation](https://reactnative.dev/docs/direct-manipulation).
263 * @see https://github.com/facebook/react-native/blob/master/Libraries/Renderer/shims/ReactNativeTypes.js#L87
264 */
265export interface NativeMethods {
266 /**
267 * Determines the location on screen, width, and height of the given view and
268 * returns the values via an async callback. If successful, the callback will
269 * be called with the following arguments:
270 *
271 * - x
272 * - y
273 * - width
274 * - height
275 * - pageX
276 * - pageY
277 *
278 * Note that these measurements are not available until after the rendering
279 * has been completed in native. If you need the measurements as soon as
280 * possible, consider using the [`onLayout`
281 * prop](docs/view.html#onlayout) instead.
282 */
283 measure(callback: MeasureOnSuccessCallback): void;
284
285 /**
286 * Determines the location of the given view in the window and returns the
287 * values via an async callback. If the React root view is embedded in
288 * another native view, this will give you the absolute coordinates. If
289 * successful, the callback will be called with the following
290 * arguments:
291 *
292 * - x
293 * - y
294 * - width
295 * - height
296 *
297 * Note that these measurements are not available until after the rendering
298 * has been completed in native.
299 */
300 measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
301
302 /**
303 * Like [`measure()`](#measure), but measures the view relative an ancestor,
304 * specified as `relativeToNativeComponentRef`. This means that the returned x, y
305 * are relative to the origin x, y of the ancestor view.
306 * _Can also be called with a relativeNativeNodeHandle but is deprecated._
307 */
308 measureLayout(
309 relativeToNativeComponentRef: HostComponent<unknown> | number,
310 onSuccess: MeasureLayoutOnSuccessCallback,
311 onFail: () => void /* currently unused */,
312 ): void;
313
314 /**
315 * This function sends props straight to native. They will not participate in
316 * future diff process - this means that if you do not include them in the
317 * next render, they will remain active (see [Direct
318 * Manipulation](https://reactnative.dev/docs/direct-manipulation)).
319 */
320 setNativeProps(nativeProps: object): void;
321
322 /**
323 * Requests focus for the given input or view. The exact behavior triggered
324 * will depend on the platform and type of view.
325 */
326 focus(): void;
327
328 /**
329 * Removes focus from an input or view. This is the opposite of `focus()`.
330 */
331 blur(): void;
332
333 refs: {
334 [key: string]: React.Component<any, any>;
335 };
336}
337
338/**
339 * @deprecated Use NativeMethods instead.
340 */
341export type NativeMethodsMixin = NativeMethods;
342/**
343 * @deprecated Use NativeMethods instead.
344 */
345export type NativeMethodsMixinType = NativeMethods;
346
347/**
348 * Represents a native component, such as those returned from `requireNativeComponent`.
349 *
350 * @see https://github.com/facebook/react-native/blob/v0.62.0-rc.5/Libraries/Renderer/shims/ReactNativeTypes.js
351 *
352 * @todo This should eventually be defined as an AbstractComponent, but that
353 * should first be introduced in the React typings.
354 */
355export interface HostComponent<P> extends Pick<React.ComponentClass<P>, Exclude<keyof React.ComponentClass<P>, 'new'>> {
356 new (props: P, context?: any): React.Component<P> & Readonly<NativeMethods>;
357}
358
359// see react-jsx.d.ts
360export function createElement<P>(
361 type: React.ElementType,
362 props?: P,
363 ...children: React.ReactNode[]
364): React.ReactElement<P>;
365
366export type Runnable = (appParameters: any) => void;
367
368type Task = (taskData: any) => Promise<void>;
369type TaskProvider = () => Task;
370
371type NodeHandle = number;
372
373// Similar to React.SyntheticEvent except for nativeEvent
374export interface NativeSyntheticEvent<T> extends React.BaseSyntheticEvent<T, NodeHandle, NodeHandle> {}
375
376export interface NativeTouchEvent {
377 /**
378 * Array of all touch events that have changed since the last event
379 */
380 changedTouches: NativeTouchEvent[];
381
382 /**
383 * The ID of the touch
384 */
385 identifier: string;
386
387 /**
388 * The X position of the touch, relative to the element
389 */
390 locationX: number;
391
392 /**
393 * The Y position of the touch, relative to the element
394 */
395 locationY: number;
396
397 /**
398 * The X position of the touch, relative to the screen
399 */
400 pageX: number;
401
402 /**
403 * The Y position of the touch, relative to the screen
404 */
405 pageY: number;
406
407 /**
408 * The node id of the element receiving the touch event
409 */
410 target: string;
411
412 /**
413 * A time identifier for the touch, useful for velocity calculation
414 */
415 timestamp: number;
416
417 /**
418 * Array of all current touches on the screen
419 */
420 touches: NativeTouchEvent[];
421
422 /**
423 * 3D Touch reported force
424 * @platform ios
425 */
426 force?: number | undefined;
427}
428
429export interface GestureResponderEvent extends NativeSyntheticEvent<NativeTouchEvent> {}
430
431// See https://reactnative.dev/docs/scrollview#contentoffset
432export interface PointPropType {
433 x: number;
434 y: number;
435}
436
437export interface Insets {
438 top?: number | undefined;
439 left?: number | undefined;
440 bottom?: number | undefined;
441 right?: number | undefined;
442}
443
444export interface PressableStateCallbackType {
445 readonly pressed: boolean;
446}
447
448export interface PressableAndroidRippleConfig {
449 color?: null | ColorValue | undefined;
450 borderless?: null | boolean | undefined;
451 radius?: null | number | undefined;
452 foreground?: null | boolean | undefined;
453}
454
455export interface PressableProps extends AccessibilityProps, Omit<ViewProps, 'children' | 'style' | 'hitSlop'> {
456 /**
457 * Called when a single tap gesture is detected.
458 */
459 onPress?: null | ((event: GestureResponderEvent) => void) | undefined;
460
461 /**
462 * Called when a touch is engaged before `onPress`.
463 */
464 onPressIn?: null | ((event: GestureResponderEvent) => void) | undefined;
465
466 /**
467 * Called when a touch is released before `onPress`.
468 */
469 onPressOut?: null | ((event: GestureResponderEvent) => void) | undefined;
470
471 /**
472 * Called when a long-tap gesture is detected.
473 */
474 onLongPress?: null | ((event: GestureResponderEvent) => void) | undefined;
475
476 /**
477 * Called after the element loses focus.
478 * @platform windows
479 */
480 onBlur?: null | ((event: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
481
482 /**
483 * Called after the element is focused.
484 * @platform windows
485 */
486 onFocus?: null | ((event: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
487
488 /**
489 * Either children or a render prop that receives a boolean reflecting whether
490 * the component is currently pressed.
491 */
492 children?: React.ReactNode | ((state: PressableStateCallbackType) => React.ReactNode) | undefined;
493
494 /**
495 * Whether a press gesture can be interrupted by a parent gesture such as a
496 * scroll event. Defaults to true.
497 */
498 cancelable?: null | boolean | undefined;
499
500 /**
501 * Duration (in milliseconds) from `onPressIn` before `onLongPress` is called.
502 */
503 delayLongPress?: null | number | undefined;
504
505 /**
506 * Whether the press behavior is disabled.
507 */
508 disabled?: null | boolean | undefined;
509
510 /**
511 * Additional distance outside of this view in which a press is detected.
512 */
513 hitSlop?: null | Insets | number | undefined;
514
515 /**
516 * Additional distance outside of this view in which a touch is considered a
517 * press before `onPressOut` is triggered.
518 */
519 pressRetentionOffset?: null | Insets | number | undefined;
520
521 /**
522 * If true, doesn't play system sound on touch.
523 */
524 android_disableSound?: null | boolean | undefined;
525
526 /**
527 * Enables the Android ripple effect and configures its color.
528 */
529 android_ripple?: null | PressableAndroidRippleConfig | undefined;
530
531 /**
532 * Used only for documentation or testing (e.g. snapshot testing).
533 */
534 testOnly_pressed?: null | boolean | undefined;
535
536 /**
537 * Either view styles or a function that receives a boolean reflecting whether
538 * the component is currently pressed and returns view styles.
539 */
540 style?: StyleProp<ViewStyle> | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>) | undefined;
541}
542
543// TODO use React.AbstractComponent when available
544export const Pressable: React.ForwardRefExoticComponent<PressableProps & React.RefAttributes<View>>;
545
546/**
547 * //FIXME: need to find documentation on which component is a TTouchable and can implement that interface
548 * @see React.DOMAtributes
549 */
550export interface Touchable {
551 onTouchStart?: ((event: GestureResponderEvent) => void) | undefined;
552 onTouchMove?: ((event: GestureResponderEvent) => void) | undefined;
553 onTouchEnd?: ((event: GestureResponderEvent) => void) | undefined;
554 onTouchCancel?: ((event: GestureResponderEvent) => void) | undefined;
555 onTouchEndCapture?: ((event: GestureResponderEvent) => void) | undefined;
556}
557export const Touchable: {
558 TOUCH_TARGET_DEBUG: boolean;
559 renderDebugView: (config: { color: string | number; hitSlop?: Insets | undefined }) => React.ReactElement | null;
560};
561
562export type ComponentProvider = () => React.ComponentType<any>;
563
564export type AppConfig = {
565 appKey: string;
566 component?: ComponentProvider | undefined;
567 run?: Runnable | undefined;
568};
569
570// https://github.com/facebook/react-native/blob/master/Libraries/ReactNative/AppRegistry.js
571/**
572 * `AppRegistry` is the JS entry point to running all React Native apps. App
573 * root components should register themselves with
574 * `AppRegistry.registerComponent`, then the native system can load the bundle
575 * for the app and then actually run the app when it's ready by invoking
576 * `AppRegistry.runApplication`.
577 *
578 * To "stop" an application when a view should be destroyed, call
579 * `AppRegistry.unmountApplicationComponentAtRootTag` with the tag that was
580 * pass into `runApplication`. These should always be used as a pair.
581 *
582 * `AppRegistry` should be `require`d early in the `require` sequence to make
583 * sure the JS execution environment is setup before other modules are
584 * `require`d.
585 */
586export namespace AppRegistry {
587 function registerConfig(config: AppConfig[]): void;
588
589 function registerComponent(appKey: string, getComponentFunc: ComponentProvider): string;
590
591 function registerRunnable(appKey: string, func: Runnable): string;
592
593 function getAppKeys(): string[];
594
595 function unmountApplicationComponentAtRootTag(rootTag: number): void;
596
597 function runApplication(appKey: string, appParameters: any): void;
598
599 function setSurfaceProps(appKey: string, appParameters: any, displayMode?: number): void;
600
601 function registerHeadlessTask(appKey: string, task: TaskProvider): void;
602
603 function getRunnable(appKey: string): Runnable | undefined;
604}
605
606export type LayoutAnimationType =
607 | 'spring'
608 | 'linear'
609 | 'easeInEaseOut'
610 | 'easeIn'
611 | 'easeOut'
612 | 'keyboard';
613
614export type LayoutAnimationTypes = {
615 [type in LayoutAnimationType]: type;
616};
617
618export type LayoutAnimationProperty =
619 | 'opacity'
620 | 'scaleX'
621 | 'scaleY'
622 | 'scaleXY';
623
624export type LayoutAnimationProperties = {
625 [prop in LayoutAnimationProperty]: prop;
626};
627
628export interface LayoutAnimationAnim {
629 duration?: number | undefined;
630 delay?: number | undefined;
631 springDamping?: number | undefined;
632 initialVelocity?: number | undefined;
633 type?: LayoutAnimationType | undefined;
634 property?: LayoutAnimationProperty | undefined;
635}
636
637export interface LayoutAnimationConfig {
638 duration: number;
639 create?: LayoutAnimationAnim | undefined;
640 update?: LayoutAnimationAnim | undefined;
641 delete?: LayoutAnimationAnim | undefined;
642}
643
644/** Automatically animates views to their new positions when the next layout happens.
645 * A common way to use this API is to call LayoutAnimation.configureNext before
646 * calling setState. */
647export interface LayoutAnimationStatic {
648 /** Schedules an animation to happen on the next layout.
649 * @param config Specifies animation properties:
650 * `duration` in milliseconds
651 * `create`, config for animating in new views (see Anim type)
652 * `update`, config for animating views that have been updated (see Anim type)
653 * @param onAnimationDidEnd Called when the animation finished. Only supported on iOS.
654 */
655 configureNext: (
656 config: LayoutAnimationConfig,
657 onAnimationDidEnd?: () => void,
658 onAnimationDidFail?: () => void,
659 ) => void;
660 /** Helper for creating a config for configureNext. */
661 create: (
662 duration: number,
663 type?: LayoutAnimationType,
664 creationProp?: LayoutAnimationProperty
665 ) => LayoutAnimationConfig;
666 Types: LayoutAnimationTypes;
667 Properties: LayoutAnimationProperties;
668 configChecker: (shapeTypes: { [key: string]: any }) => any;
669 Presets: {
670 easeInEaseOut: LayoutAnimationConfig;
671 linear: LayoutAnimationConfig;
672 spring: LayoutAnimationConfig;
673 };
674 easeInEaseOut: (onAnimationDidEnd?: () => void) => void;
675 linear: (onAnimationDidEnd?: () => void) => void;
676 spring: (onAnimationDidEnd?: () => void) => void;
677}
678
679type FlexAlignType = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
680
681/**
682 * Flex Prop Types
683 * @see https://reactnative.dev/docs/flexbox#proptypes
684 * @see https://reactnative.dev/docs/layout-props
685 * @see https://github.com/facebook/react-native/blob/master/Libraries/StyleSheet/LayoutPropTypes.js
686 */
687export interface FlexStyle {
688 alignContent?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'space-between' | 'space-around' | undefined;
689 alignItems?: FlexAlignType | undefined;
690 alignSelf?: 'auto' | FlexAlignType | undefined;
691 aspectRatio?: number | undefined;
692 borderBottomWidth?: number | undefined;
693 borderEndWidth?: number | string | undefined;
694 borderLeftWidth?: number | undefined;
695 borderRightWidth?: number | undefined;
696 borderStartWidth?: number | string | undefined;
697 borderTopWidth?: number | undefined;
698 borderWidth?: number | undefined;
699 bottom?: number | string | undefined;
700 display?: 'none' | 'flex' | undefined;
701 end?: number | string | undefined;
702 flex?: number | undefined;
703 flexBasis?: number | string | undefined;
704 flexDirection?: 'row' | 'column' | 'row-reverse' | 'column-reverse' | undefined;
705 flexGrow?: number | undefined;
706 flexShrink?: number | undefined;
707 flexWrap?: 'wrap' | 'nowrap' | 'wrap-reverse' | undefined;
708 height?: number | string | undefined;
709 justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly' | undefined;
710 left?: number | string | undefined;
711 margin?: number | string | undefined;
712 marginBottom?: number | string | undefined;
713 marginEnd?: number | string | undefined;
714 marginHorizontal?: number | string | undefined;
715 marginLeft?: number | string | undefined;
716 marginRight?: number | string | undefined;
717 marginStart?: number | string | undefined;
718 marginTop?: number | string | undefined;
719 marginVertical?: number | string | undefined;
720 maxHeight?: number | string | undefined;
721 maxWidth?: number | string | undefined;
722 minHeight?: number | string | undefined;
723 minWidth?: number | string | undefined;
724 overflow?: 'visible' | 'hidden' | 'scroll' | undefined;
725 padding?: number | string | undefined;
726 paddingBottom?: number | string | undefined;
727 paddingEnd?: number | string | undefined;
728 paddingHorizontal?: number | string | undefined;
729 paddingLeft?: number | string | undefined;
730 paddingRight?: number | string | undefined;
731 paddingStart?: number | string | undefined;
732 paddingTop?: number | string | undefined;
733 paddingVertical?: number | string | undefined;
734 position?: 'absolute' | 'relative' | undefined;
735 right?: number | string | undefined;
736 start?: number | string | undefined;
737 top?: number | string | undefined;
738 width?: number | string | undefined;
739 zIndex?: number | undefined;
740
741 /**
742 * @platform ios
743 */
744 direction?: 'inherit' | 'ltr' | 'rtl' | undefined;
745}
746
747/**
748 * @see ShadowPropTypesIOS.js
749 */
750export interface ShadowPropTypesIOSStatic {
751 /**
752 * Sets the drop shadow color
753 * @platform ios
754 */
755 shadowColor: ColorValue;
756
757 /**
758 * Sets the drop shadow offset
759 * @platform ios
760 */
761 shadowOffset: { width: number; height: number };
762
763 /**
764 * Sets the drop shadow opacity (multiplied by the color's alpha component)
765 * @platform ios
766 */
767 shadowOpacity: number;
768
769 /**
770 * Sets the drop shadow blur radius
771 * @platform ios
772 */
773 shadowRadius: number;
774}
775
776interface PerpectiveTransform {
777 perspective: number;
778}
779
780interface RotateTransform {
781 rotate: string;
782}
783
784interface RotateXTransform {
785 rotateX: string;
786}
787
788interface RotateYTransform {
789 rotateY: string;
790}
791
792interface RotateZTransform {
793 rotateZ: string;
794}
795
796interface ScaleTransform {
797 scale: number;
798}
799
800interface ScaleXTransform {
801 scaleX: number;
802}
803
804interface ScaleYTransform {
805 scaleY: number;
806}
807
808interface TranslateXTransform {
809 translateX: number;
810}
811
812interface TranslateYTransform {
813 translateY: number;
814}
815
816interface SkewXTransform {
817 skewX: string;
818}
819
820interface SkewYTransform {
821 skewY: string;
822}
823
824interface MatrixTransform {
825 matrix: number[];
826}
827
828export interface TransformsStyle {
829 transform?: (
830 | PerpectiveTransform
831 | RotateTransform
832 | RotateXTransform
833 | RotateYTransform
834 | RotateZTransform
835 | ScaleTransform
836 | ScaleXTransform
837 | ScaleYTransform
838 | TranslateXTransform
839 | TranslateYTransform
840 | SkewXTransform
841 | SkewYTransform
842 | MatrixTransform
843 )[] | undefined;
844 /**
845 * @deprecated Use matrix in transform prop instead.
846 */
847 transformMatrix?: Array<number> | undefined;
848 /**
849 * @deprecated Use rotate in transform prop instead.
850 */
851 rotation?: number | undefined;
852 /**
853 * @deprecated Use scaleX in transform prop instead.
854 */
855 scaleX?: number | undefined;
856 /**
857 * @deprecated Use scaleY in transform prop instead.
858 */
859 scaleY?: number | undefined;
860 /**
861 * @deprecated Use translateX in transform prop instead.
862 */
863 translateX?: number | undefined;
864 /**
865 * @deprecated Use translateY in transform prop instead.
866 */
867 translateY?: number | undefined;
868}
869
870export interface StyleSheetProperties {
871 hairlineWidth: number;
872 flatten<T extends string>(style: T): T;
873}
874
875export interface LayoutRectangle {
876 x: number;
877 y: number;
878 width: number;
879 height: number;
880}
881
882// @see TextProps.onLayout
883export type LayoutChangeEvent = NativeSyntheticEvent<{ layout: LayoutRectangle }>;
884
885interface TextLayoutLine {
886 ascender: number;
887 capHeight: number;
888 descender: number;
889 height: number;
890 text: string;
891 width: number;
892 x: number;
893 xHeight: number;
894 y: number;
895}
896
897/**
898 * @see TextProps.onTextLayout
899 */
900export interface TextLayoutEventData extends TargetedEvent {
901 lines: TextLayoutLine[];
902}
903
904export type FontVariant = 'small-caps' | 'oldstyle-nums' | 'lining-nums' | 'tabular-nums' | 'proportional-nums';
905export interface TextStyleIOS extends ViewStyle {
906 fontVariant?: FontVariant[] | undefined;
907 letterSpacing?: number | undefined;
908 textDecorationColor?: ColorValue | undefined;
909 textDecorationStyle?: 'solid' | 'double' | 'dotted' | 'dashed' | undefined;
910 writingDirection?: 'auto' | 'ltr' | 'rtl' | undefined;
911}
912
913export interface TextStyleAndroid extends ViewStyle {
914 textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center' | undefined;
915 includeFontPadding?: boolean | undefined;
916}
917
918// @see https://reactnative.dev/docs/text#style
919export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle {
920 color?: ColorValue | undefined;
921 fontFamily?: string | undefined;
922 fontSize?: number | undefined;
923 fontStyle?: 'normal' | 'italic' | undefined;
924 /**
925 * Specifies font weight. The values 'normal' and 'bold' are supported
926 * for most fonts. Not all fonts have a variant for each of the numeric
927 * values, in that case the closest one is chosen.
928 */
929 fontWeight?: 'normal' | 'bold' | '100' | '200' | '300' | '400' | '500' | '600' | '700' | '800' | '900' | undefined;
930 letterSpacing?: number | undefined;
931 lineHeight?: number | undefined;
932 textAlign?: 'auto' | 'left' | 'right' | 'center' | 'justify' | undefined;
933 textDecorationLine?: 'none' | 'underline' | 'line-through' | 'underline line-through' | undefined;
934 textDecorationStyle?: 'solid' | 'double' | 'dotted' | 'dashed' | undefined;
935 textDecorationColor?: ColorValue | undefined;
936 textShadowColor?: ColorValue | undefined;
937 textShadowOffset?: { width: number; height: number } | undefined;
938 textShadowRadius?: number | undefined;
939 textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase' | undefined;
940 testID?: string | undefined;
941}
942
943export interface TextPropsIOS {
944 /**
945 * Specifies whether font should be scaled down automatically to fit given style constraints.
946 */
947 adjustsFontSizeToFit?: boolean | undefined;
948
949 /**
950 * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
951 */
952 minimumFontScale?: number | undefined;
953
954 /**
955 * When `true`, no visual change is made when text is pressed down. By
956 * default, a gray oval highlights the text on press down.
957 */
958 suppressHighlighting?: boolean | undefined;
959}
960
961export interface TextPropsAndroid {
962 /**
963 * Lets the user select text, to use the native copy and paste functionality.
964 */
965 selectable?: boolean | undefined;
966
967 /**
968 * The highlight color of the text.
969 */
970 selectionColor?: ColorValue | undefined;
971
972 /**
973 * Set text break strategy on Android API Level 23+
974 * default is `highQuality`.
975 */
976 textBreakStrategy?: 'simple' | 'highQuality' | 'balanced' | undefined;
977
978 /**
979 * Determines the types of data converted to clickable URLs in the text element.
980 * By default no data types are detected.
981 */
982 dataDetectorType?: null | 'phoneNumber' | 'link' | 'email' | 'none' | 'all' | undefined;
983
984 /**
985 * Hyphenation strategy
986 */
987 android_hyphenationFrequency?:
988 | 'normal'
989 | 'none'
990 | 'full'
991 | undefined;
992}
993
994// https://reactnative.dev/docs/text#props
995export interface TextProps extends TextPropsIOS, TextPropsAndroid, AccessibilityProps {
996 /**
997 * Specifies whether fonts should scale to respect Text Size accessibility settings.
998 * The default is `true`.
999 */
1000 allowFontScaling?: boolean | undefined;
1001
1002 children?: React.ReactNode;
1003
1004 /**
1005 * This can be one of the following values:
1006 *
1007 * - `head` - The line is displayed so that the end fits in the container and the missing text
1008 * at the beginning of the line is indicated by an ellipsis glyph. e.g., "...wxyz"
1009 * - `middle` - The line is displayed so that the beginning and end fit in the container and the
1010 * missing text in the middle is indicated by an ellipsis glyph. "ab...yz"
1011 * - `tail` - The line is displayed so that the beginning fits in the container and the
1012 * missing text at the end of the line is indicated by an ellipsis glyph. e.g., "abcd..."
1013 * - `clip` - Lines are not drawn past the edge of the text container.
1014 *
1015 * The default is `tail`.
1016 *
1017 * `numberOfLines` must be set in conjunction with this prop.
1018 *
1019 * > `clip` is working only for iOS
1020 */
1021 ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip' | undefined;
1022
1023 /**
1024 * Line Break mode. Works only with numberOfLines.
1025 * clip is working only for iOS
1026 */
1027 lineBreakMode?: 'head' | 'middle' | 'tail' | 'clip' | undefined;
1028
1029 /**
1030 * Used to truncate the text with an ellipsis after computing the text
1031 * layout, including line wrapping, such that the total number of lines
1032 * does not exceed this number.
1033 *
1034 * This prop is commonly used with `ellipsizeMode`.
1035 */
1036 numberOfLines?: number | undefined;
1037
1038 /**
1039 * Invoked on mount and layout changes with
1040 *
1041 * {nativeEvent: { layout: {x, y, width, height}}}.
1042 */
1043 onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
1044
1045 /**
1046 * Invoked on Text layout
1047 */
1048 onTextLayout?: ((event: NativeSyntheticEvent<TextLayoutEventData>) => void) | undefined;
1049
1050 /**
1051 * This function is called on press.
1052 * Text intrinsically supports press handling with a default highlight state (which can be disabled with suppressHighlighting).
1053 */
1054 onPress?: ((event: GestureResponderEvent) => void) | undefined;
1055
1056 onPressIn?: ((event: GestureResponderEvent) => void) | undefined;
1057 onPressOut?: ((event: GestureResponderEvent) => void) | undefined;
1058
1059 /**
1060 * This function is called on long press.
1061 * e.g., `onLongPress={this.increaseSize}>``
1062 */
1063 onLongPress?: ((event: GestureResponderEvent) => void) | undefined;
1064
1065 /**
1066 * @see https://reactnative.dev/docs/text#style
1067 */
1068 style?: StyleProp<TextStyle> | undefined;
1069
1070 /**
1071 * Used to locate this view in end-to-end tests.
1072 */
1073 testID?: string | undefined;
1074
1075 /**
1076 * Used to reference react managed views from native code.
1077 */
1078 nativeID?: string | undefined;
1079
1080 /**
1081 * Specifies largest possible scale a font can reach when allowFontScaling is enabled. Possible values:
1082 * - null/undefined (default): inherit from the parent node or the global default (0)
1083 * - 0: no max, ignore parent/global default
1084 * - >= 1: sets the maxFontSizeMultiplier of this node to this value
1085 */
1086 maxFontSizeMultiplier?: number | null | undefined;
1087}
1088
1089/**
1090 * A React component for displaying text which supports nesting, styling, and touch handling.
1091 */
1092declare class TextComponent extends React.Component<TextProps> {}
1093declare const TextBase: Constructor<NativeMethods> & typeof TextComponent;
1094export class Text extends TextBase {}
1095
1096type DataDetectorTypes = 'phoneNumber' | 'link' | 'address' | 'calendarEvent' | 'none' | 'all';
1097
1098/**
1099 * DocumentSelectionState is responsible for maintaining selection information
1100 * for a document.
1101 *
1102 * It is intended for use by AbstractTextEditor-based components for
1103 * identifying the appropriate start/end positions to modify the
1104 * DocumentContent, and for programmatically setting browser selection when
1105 * components re-render.
1106 */
1107export interface DocumentSelectionState extends EventEmitter {
1108 new (anchor: number, focus: number): DocumentSelectionState;
1109
1110 /**
1111 * Apply an update to the state. If either offset value has changed,
1112 * set the values and emit the `change` event. Otherwise no-op.
1113 *
1114 */
1115 update(anchor: number, focus: number): void;
1116
1117 /**
1118 * Given a max text length, constrain our selection offsets to ensure
1119 * that the selection remains strictly within the text range.
1120 *
1121 */
1122 constrainLength(maxLength: number): void;
1123
1124 focus(): void;
1125 blur(): void;
1126 hasFocus(): boolean;
1127 isCollapsed(): boolean;
1128 isBackward(): boolean;
1129
1130 getAnchorOffset(): number;
1131 getFocusOffset(): number;
1132 getStartOffset(): number;
1133 getEndOffset(): number;
1134 overlaps(start: number, end: number): boolean;
1135}
1136
1137/**
1138 * IOS Specific properties for TextInput
1139 * @see https://reactnative.dev/docs/textinput#props
1140 */
1141export interface TextInputIOSProps {
1142 /**
1143 * enum('never', 'while-editing', 'unless-editing', 'always')
1144 * When the clear button should appear on the right side of the text view
1145 */
1146 clearButtonMode?: 'never' | 'while-editing' | 'unless-editing' | 'always' | undefined;
1147
1148 /**
1149 * If true, clears the text field automatically when editing begins
1150 */
1151 clearTextOnFocus?: boolean | undefined;
1152
1153 /**
1154 * Determines the types of data converted to clickable URLs in the text input.
1155 * Only valid if `multiline={true}` and `editable={false}`.
1156 * By default no data types are detected.
1157 *
1158 * You can provide one type or an array of many types.
1159 *
1160 * Possible values for `dataDetectorTypes` are:
1161 *
1162 * - `'phoneNumber'`
1163 * - `'link'`
1164 * - `'address'`
1165 * - `'calendarEvent'`
1166 * - `'none'`
1167 * - `'all'`
1168 */
1169 dataDetectorTypes?: DataDetectorTypes | DataDetectorTypes[] | undefined;
1170
1171 /**
1172 * If true, the keyboard disables the return key when there is no text and automatically enables it when there is text.
1173 * The default value is false.
1174 */
1175 enablesReturnKeyAutomatically?: boolean | undefined;
1176
1177 /**
1178 * Determines the color of the keyboard.
1179 */
1180 keyboardAppearance?: 'default' | 'light' | 'dark' | undefined;
1181
1182 /**
1183 * Provide rules for your password.
1184 * For example, say you want to require a password with at least eight characters consisting of a mix of uppercase and lowercase letters, at least one number, and at most two consecutive characters.
1185 * "required: upper; required: lower; required: digit; max-consecutive: 2; minlength: 8;"
1186 */
1187 passwordRules?: string | null | undefined;
1188
1189 /**
1190 * If `true`, allows TextInput to pass touch events to the parent component.
1191 * This allows components to be swipeable from the TextInput on iOS,
1192 * as is the case on Android by default.
1193 * If `false`, TextInput always asks to handle the input (except when disabled).
1194 */
1195 rejectResponderTermination?: boolean | null | undefined;
1196
1197 /**
1198 * See DocumentSelectionState.js, some state that is responsible for maintaining selection information for a document
1199 */
1200 selectionState?: DocumentSelectionState | undefined;
1201
1202 /**
1203 * If false, disables spell-check style (i.e. red underlines). The default value is inherited from autoCorrect
1204 */
1205 spellCheck?: boolean | undefined;
1206
1207 /**
1208 * Give the keyboard and the system information about the expected
1209 * semantic meaning for the content that users enter.
1210 *
1211 * For iOS 11+ you can set `textContentType` to `username` or `password` to
1212 * enable autofill of login details from the device keychain.
1213 *
1214 * For iOS 12+ `newPassword` can be used to indicate a new password input the
1215 * user may want to save in the keychain, and `oneTimeCode` can be used to indicate
1216 * that a field can be autofilled by a code arriving in an SMS.
1217 *
1218 * To disable autofill, set textContentType to `none`.
1219 *
1220 * Possible values for `textContentType` are:
1221 *
1222 * - `'none'`
1223 * - `'URL'`
1224 * - `'addressCity'`
1225 * - `'addressCityAndState'`
1226 * - `'addressState'`
1227 * - `'countryName'`
1228 * - `'creditCardNumber'`
1229 * - `'emailAddress'`
1230 * - `'familyName'`
1231 * - `'fullStreetAddress'`
1232 * - `'givenName'`
1233 * - `'jobTitle'`
1234 * - `'location'`
1235 * - `'middleName'`
1236 * - `'name'`
1237 * - `'namePrefix'`
1238 * - `'nameSuffix'`
1239 * - `'nickname'`
1240 * - `'organizationName'`
1241 * - `'postalCode'`
1242 * - `'streetAddressLine1'`
1243 * - `'streetAddressLine2'`
1244 * - `'sublocality'`
1245 * - `'telephoneNumber'`
1246 * - `'username'`
1247 * - `'password'`
1248 * - `'newPassword'`
1249 * - `'oneTimeCode'`
1250 *
1251 */
1252 textContentType?:
1253 | 'none'
1254 | 'URL'
1255 | 'addressCity'
1256 | 'addressCityAndState'
1257 | 'addressState'
1258 | 'countryName'
1259 | 'creditCardNumber'
1260 | 'emailAddress'
1261 | 'familyName'
1262 | 'fullStreetAddress'
1263 | 'givenName'
1264 | 'jobTitle'
1265 | 'location'
1266 | 'middleName'
1267 | 'name'
1268 | 'namePrefix'
1269 | 'nameSuffix'
1270 | 'nickname'
1271 | 'organizationName'
1272 | 'postalCode'
1273 | 'streetAddressLine1'
1274 | 'streetAddressLine2'
1275 | 'sublocality'
1276 | 'telephoneNumber'
1277 | 'username'
1278 | 'password'
1279 | 'newPassword'
1280 | 'oneTimeCode'
1281 | undefined;
1282
1283 /**
1284 * If false, scrolling of the text view will be disabled. The default value is true. Only works with multiline={true}
1285 */
1286 scrollEnabled?: boolean | undefined;
1287}
1288
1289/**
1290 * Android Specific properties for TextInput
1291 * @see https://reactnative.dev/docs/textinput#props
1292 */
1293export interface TextInputAndroidProps {
1294 /**
1295 * Specifies autocomplete hints for the system, so it can provide autofill. On Android, the system will always attempt to offer autofill by using heuristics to identify the type of content.
1296 * To disable autocomplete, set `autoComplete` to `off`.
1297 *
1298 * *Android Only*
1299 *
1300 * Possible values for `autoComplete` are:
1301 *
1302 * - `birthdate-day`
1303 * - `birthdate-full`
1304 * - `birthdate-month`
1305 * - `birthdate-year`
1306 * - `cc-csc`
1307 * - `cc-exp`
1308 * - `cc-exp-day`
1309 * - `cc-exp-month`
1310 * - `cc-exp-year`
1311 * - `cc-number`
1312 * - `email`
1313 * - `gender`
1314 * - `name`
1315 * - `name-family`
1316 * - `name-given`
1317 * - `name-middle`
1318 * - `name-middle-initial`
1319 * - `name-prefix`
1320 * - `name-suffix`
1321 * - `password`
1322 * - `password-new`
1323 * - `postal-address`
1324 * - `postal-address-country`
1325 * - `postal-address-extended`
1326 * - `postal-address-extended-postal-code`
1327 * - `postal-address-locality`
1328 * - `postal-address-region`
1329 * - `postal-code`
1330 * - `street-address`
1331 * - `sms-otp`
1332 * - `tel`
1333 * - `tel-country-code`
1334 * - `tel-national`
1335 * - `tel-device`
1336 * - `username`
1337 * - `username-new`
1338 * - `off`
1339 */
1340 autoComplete?:
1341 | 'birthdate-day'
1342 | 'birthdate-full'
1343 | 'birthdate-month'
1344 | 'birthdate-year'
1345 | 'cc-csc'
1346 | 'cc-exp'
1347 | 'cc-exp-day'
1348 | 'cc-exp-month'
1349 | 'cc-exp-year'
1350 | 'cc-number'
1351 | 'email'
1352 | 'gender'
1353 | 'name'
1354 | 'name-family'
1355 | 'name-given'
1356 | 'name-middle'
1357 | 'name-middle-initial'
1358 | 'name-prefix'
1359 | 'name-suffix'
1360 | 'password'
1361 | 'password-new'
1362 | 'postal-address'
1363 | 'postal-address-country'
1364 | 'postal-address-extended'
1365 | 'postal-address-extended-postal-code'
1366 | 'postal-address-locality'
1367 | 'postal-address-region'
1368 | 'postal-code'
1369 | 'street-address'
1370 | 'sms-otp'
1371 | 'tel'
1372 | 'tel-country-code'
1373 | 'tel-national'
1374 | 'tel-device'
1375 | 'username'
1376 | 'username-new'
1377 | 'off'
1378 | undefined;
1379
1380 /**
1381 * Determines whether the individual fields in your app should be included in a
1382 * view structure for autofill purposes on Android API Level 26+. Defaults to auto.
1383 * To disable auto complete, use `off`.
1384 *
1385 * *Android Only*
1386 *
1387 * The following values work on Android only:
1388 *
1389 * - `auto` - let Android decide
1390 * - `no` - not important for autofill
1391 * - `noExcludeDescendants` - this view and its children aren't important for autofill
1392 * - `yes` - is important for autofill
1393 * - `yesExcludeDescendants` - this view is important for autofill but its children aren't
1394 */
1395 importantForAutofill?: 'auto' | 'no' | 'noExcludeDescendants' | 'yes' | 'yesExcludeDescendants' | undefined;
1396
1397 /**
1398 * When false, if there is a small amount of space available around a text input (e.g. landscape orientation on a phone),
1399 * the OS may choose to have the user edit the text inside of a full screen text input mode.
1400 * When true, this feature is disabled and users will always edit the text directly inside of the text input.
1401 * Defaults to false.
1402 */
1403 disableFullscreenUI?: boolean | undefined;
1404
1405 /**
1406 * If defined, the provided image resource will be rendered on the left.
1407 */
1408 inlineImageLeft?: string | undefined;
1409
1410 /**
1411 * Padding between the inline image, if any, and the text input itself.
1412 */
1413 inlineImagePadding?: number | undefined;
1414
1415 /**
1416 * Sets the number of lines for a TextInput.
1417 * Use it with multiline set to true to be able to fill the lines.
1418 */
1419 numberOfLines?: number | undefined;
1420
1421 /**
1422 * Sets the return key to the label. Use it instead of `returnKeyType`.
1423 * @platform android
1424 */
1425 returnKeyLabel?: string | undefined;
1426
1427 /**
1428 * Set text break strategy on Android API Level 23+, possible values are simple, highQuality, balanced
1429 * The default value is simple.
1430 */
1431 textBreakStrategy?: 'simple' | 'highQuality' | 'balanced' | undefined;
1432
1433 /**
1434 * The color of the textInput underline.
1435 */
1436 underlineColorAndroid?: ColorValue | undefined;
1437
1438 /**
1439 * Vertically align text when `multiline` is set to true
1440 */
1441 textAlignVertical?: 'auto' | 'top' | 'bottom' | 'center' | undefined;
1442
1443 /**
1444 * When false, it will prevent the soft keyboard from showing when the field is focused. The default value is true
1445 */
1446 showSoftInputOnFocus?: boolean | undefined;
1447}
1448
1449export type KeyboardType = 'default' | 'email-address' | 'numeric' | 'phone-pad' | 'number-pad' | 'decimal-pad';
1450export type KeyboardTypeIOS =
1451 | 'ascii-capable'
1452 | 'numbers-and-punctuation'
1453 | 'url'
1454 | 'name-phone-pad'
1455 | 'twitter'
1456 | 'web-search';
1457export type KeyboardTypeAndroid = 'visible-password';
1458export type KeyboardTypeOptions = KeyboardType | KeyboardTypeAndroid | KeyboardTypeIOS;
1459
1460export type ReturnKeyType = 'done' | 'go' | 'next' | 'search' | 'send';
1461export type ReturnKeyTypeAndroid = 'none' | 'previous';
1462export type ReturnKeyTypeIOS = 'default' | 'google' | 'join' | 'route' | 'yahoo' | 'emergency-call';
1463export type ReturnKeyTypeOptions = ReturnKeyType | ReturnKeyTypeAndroid | ReturnKeyTypeIOS;
1464
1465export interface TargetedEvent {
1466 target: number;
1467}
1468
1469/**
1470 * @see TextInputProps.onFocus
1471 */
1472export interface TextInputFocusEventData extends TargetedEvent {
1473 text: string;
1474 eventCount: number;
1475}
1476
1477/**
1478 * @see TextInputProps.onScroll
1479 */
1480export interface TextInputScrollEventData {
1481 contentOffset: { x: number; y: number };
1482}
1483
1484/**
1485 * @see TextInputProps.onSelectionChange
1486 */
1487export interface TextInputSelectionChangeEventData extends TargetedEvent {
1488 selection: {
1489 start: number;
1490 end: number;
1491 };
1492}
1493
1494/**
1495 * @see TextInputProps.onKeyPress
1496 */
1497export interface TextInputKeyPressEventData {
1498 key: string;
1499}
1500
1501/**
1502 * @see TextInputProps.onChange
1503 */
1504export interface TextInputChangeEventData extends TargetedEvent {
1505 eventCount: number;
1506 text: string;
1507}
1508
1509/**
1510 * @see TextInputProps.onContentSizeChange
1511 */
1512export interface TextInputContentSizeChangeEventData {
1513 contentSize: { width: number; height: number };
1514}
1515
1516/**
1517 * @see TextInputProps.onEndEditing
1518 */
1519export interface TextInputEndEditingEventData {
1520 text: string;
1521}
1522
1523/**
1524 * @see TextInputProps.onSubmitEditing
1525 */
1526export interface TextInputSubmitEditingEventData {
1527 text: string;
1528}
1529
1530/**
1531 * @see TextInputProps.onTextInput
1532 */
1533export interface TextInputTextInputEventData {
1534 text: string;
1535 previousText: string;
1536 range: { start: number; end: number };
1537}
1538
1539/**
1540 * @see https://reactnative.dev/docs/textinput#props
1541 */
1542export interface TextInputProps extends ViewProps, TextInputIOSProps, TextInputAndroidProps, AccessibilityProps {
1543 /**
1544 * Specifies whether fonts should scale to respect Text Size accessibility settings.
1545 * The default is `true`.
1546 */
1547 allowFontScaling?: boolean | undefined;
1548
1549 /**
1550 * Can tell TextInput to automatically capitalize certain characters.
1551 * characters: all characters,
1552 * words: first letter of each word
1553 * sentences: first letter of each sentence (default)
1554 * none: don't auto capitalize anything
1555 *
1556 * https://reactnative.dev/docs/textinput#autocapitalize
1557 */
1558 autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters' | undefined;
1559
1560 /**
1561 * If false, disables auto-correct.
1562 * The default value is true.
1563 */
1564 autoCorrect?: boolean | undefined;
1565
1566 /**
1567 * If true, focuses the input on componentDidMount.
1568 * The default value is false.
1569 */
1570 autoFocus?: boolean | undefined;
1571
1572 /**
1573 * If true, the text field will blur when submitted.
1574 * The default value is true.
1575 */
1576 blurOnSubmit?: boolean | undefined;
1577
1578 /**
1579 * If true, caret is hidden. The default value is false.
1580 */
1581 caretHidden?: boolean | undefined;
1582
1583 /**
1584 * If true, context menu is hidden. The default value is false.
1585 */
1586 contextMenuHidden?: boolean | undefined;
1587
1588 /**
1589 * Provides an initial value that will change when the user starts typing.
1590 * Useful for simple use-cases where you don't want to deal with listening to events
1591 * and updating the value prop to keep the controlled state in sync.
1592 */
1593 defaultValue?: string | undefined;
1594
1595 /**
1596 * If false, text is not editable. The default value is true.
1597 */
1598 editable?: boolean | undefined;
1599
1600 /**
1601 * enum("default", 'numeric', 'email-address', "ascii-capable", 'numbers-and-punctuation', 'url', 'number-pad', 'phone-pad', 'name-phone-pad',
1602 * 'decimal-pad', 'twitter', 'web-search', 'visible-password')
1603 * Determines which keyboard to open, e.g.numeric.
1604 * The following values work across platforms: - default - numeric - email-address - phone-pad
1605 * The following values work on iOS: - ascii-capable - numbers-and-punctuation - url - number-pad - name-phone-pad - decimal-pad - twitter - web-search
1606 * The following values work on Android: - visible-password
1607 */
1608 keyboardType?: KeyboardTypeOptions | undefined;
1609
1610 /**
1611 * Limits the maximum number of characters that can be entered.
1612 * Use this instead of implementing the logic in JS to avoid flicker.
1613 */
1614 maxLength?: number | undefined;
1615
1616 /**
1617 * If true, the text input can be multiple lines. The default value is false.
1618 */
1619 multiline?: boolean | undefined;
1620
1621 /**
1622 * Callback that is called when the text input is blurred
1623 */
1624 onBlur?: ((e: NativeSyntheticEvent<TextInputFocusEventData>) => void) | undefined;
1625
1626 /**
1627 * Callback that is called when the text input's text changes.
1628 */
1629 onChange?: ((e: NativeSyntheticEvent<TextInputChangeEventData>) => void) | undefined;
1630
1631 /**
1632 * Callback that is called when the text input's text changes.
1633 * Changed text is passed as an argument to the callback handler.
1634 */
1635 onChangeText?: ((text: string) => void) | undefined;
1636
1637 /**
1638 * Callback that is called when the text input's content size changes.
1639 * This will be called with
1640 * `{ nativeEvent: { contentSize: { width, height } } }`.
1641 *
1642 * Only called for multiline text inputs.
1643 */
1644 onContentSizeChange?: ((e: NativeSyntheticEvent<TextInputContentSizeChangeEventData>) => void) | undefined;
1645
1646 /**
1647 * Callback that is called when text input ends.
1648 */
1649 onEndEditing?: ((e: NativeSyntheticEvent<TextInputEndEditingEventData>) => void) | undefined;
1650
1651 /**
1652 * Callback that is called when a touch is engaged.
1653 */
1654 onPressIn?: ((e: NativeSyntheticEvent<NativeTouchEvent>) => void) | undefined;
1655
1656 /**
1657 * Callback that is called when a touch is released.
1658 */
1659 onPressOut?: ((e: NativeSyntheticEvent<NativeTouchEvent>) => void) | undefined;
1660
1661 /**
1662 * Callback that is called when the text input is focused
1663 */
1664 onFocus?: ((e: NativeSyntheticEvent<TextInputFocusEventData>) => void) | undefined;
1665
1666 /**
1667 * Callback that is called when the text input selection is changed.
1668 */
1669 onSelectionChange?: ((e: NativeSyntheticEvent<TextInputSelectionChangeEventData>) => void) | undefined;
1670
1671 /**
1672 * Callback that is called when the text input's submit button is pressed.
1673 */
1674 onSubmitEditing?: ((e: NativeSyntheticEvent<TextInputSubmitEditingEventData>) => void) | undefined;
1675
1676 /**
1677 * Callback that is called on new text input with the argument
1678 * `{ nativeEvent: { text, previousText, range: { start, end } } }`.
1679 *
1680 * This prop requires multiline={true} to be set.
1681 */
1682 onTextInput?: ((e: NativeSyntheticEvent<TextInputTextInputEventData>) => void) | undefined;
1683
1684 /**
1685 * Invoked on content scroll with
1686 * `{ nativeEvent: { contentOffset: { x, y } } }`.
1687 *
1688 * May also contain other properties from ScrollEvent but on Android contentSize is not provided for performance reasons.
1689 */
1690 onScroll?: ((e: NativeSyntheticEvent<TextInputScrollEventData>) => void) | undefined;
1691
1692 /**
1693 * Callback that is called when a key is pressed.
1694 * This will be called with
1695 * `{ nativeEvent: { key: keyValue } }`
1696 * where keyValue is 'Enter' or 'Backspace' for respective keys and the typed-in character otherwise including ' ' for space.
1697 *
1698 * Fires before onChange callbacks.
1699 * Note: on Android only the inputs from soft keyboard are handled, not the hardware keyboard inputs.
1700 */
1701 onKeyPress?: ((e: NativeSyntheticEvent<TextInputKeyPressEventData>) => void) | undefined;
1702
1703 /**
1704 * The string that will be rendered before text input has been entered
1705 */
1706 placeholder?: string | undefined;
1707
1708 /**
1709 * The text color of the placeholder string
1710 */
1711 placeholderTextColor?: ColorValue | undefined;
1712
1713 /**
1714 * enum('default', 'go', 'google', 'join', 'next', 'route', 'search', 'send', 'yahoo', 'done', 'emergency-call')
1715 * Determines how the return key should look.
1716 */
1717 returnKeyType?: ReturnKeyTypeOptions | undefined;
1718
1719 /**
1720 * If true, the text input obscures the text entered so that sensitive text like passwords stay secure.
1721 * The default value is false.
1722 */
1723 secureTextEntry?: boolean | undefined;
1724
1725 /**
1726 * If true, all text will automatically be selected on focus
1727 */
1728 selectTextOnFocus?: boolean | undefined;
1729
1730 /**
1731 * The start and end of the text input's selection. Set start and end to
1732 * the same value to position the cursor.
1733 */
1734 selection?: { start: number; end?: number | undefined } | undefined;
1735
1736 /**
1737 * The highlight (and cursor on ios) color of the text input
1738 */
1739 selectionColor?: ColorValue | undefined;
1740
1741 /**
1742 * Styles
1743 */
1744 style?: StyleProp<TextStyle> | undefined;
1745
1746 /**
1747 * Align the input text to the left, center, or right sides of the input field.
1748 */
1749 textAlign?: 'left' | 'center' | 'right' | undefined;
1750
1751 /**
1752 * Used to locate this view in end-to-end tests
1753 */
1754 testID?: string | undefined;
1755
1756 /**
1757 * Used to connect to an InputAccessoryView. Not part of react-natives documentation, but present in examples and
1758 * code.
1759 * See https://reactnative.dev/docs/inputaccessoryview for more information.
1760 */
1761 inputAccessoryViewID?: string | undefined;
1762
1763 /**
1764 * The value to show for the text input. TextInput is a controlled component,
1765 * which means the native value will be forced to match this value prop if provided.
1766 * For most uses this works great, but in some cases this may cause flickering - one common cause is preventing edits by keeping value the same.
1767 * In addition to simply setting the same value, either set editable={false},
1768 * or set/update maxLength to prevent unwanted edits without flicker.
1769 */
1770 value?: string | undefined;
1771
1772 /**
1773 * Specifies largest possible scale a font can reach when allowFontScaling is enabled. Possible values:
1774 * - null/undefined (default): inherit from the parent node or the global default (0)
1775 * - 0: no max, ignore parent/global default
1776 * - >= 1: sets the maxFontSizeMultiplier of this node to this value
1777 */
1778 maxFontSizeMultiplier?: number | null | undefined;
1779}
1780
1781/**
1782 * This class is responsible for coordinating the "focused"
1783 * state for TextInputs. All calls relating to the keyboard
1784 * should be funneled through here
1785 */
1786interface TextInputState {
1787 /**
1788 * @deprecated Use currentlyFocusedInput
1789 * Returns the ID of the currently focused text field, if one exists
1790 * If no text field is focused it returns null
1791 */
1792 currentlyFocusedField(): number;
1793
1794 /**
1795 * Returns the ref of the currently focused text field, if one exists
1796 * If no text field is focused it returns null
1797 */
1798 currentlyFocusedInput(): React.ElementRef<HostComponent<unknown>>;
1799
1800 /**
1801 * @param textField ref of the text field to focus
1802 * Focuses the specified text field
1803 * noop if the text field was already focused
1804 */
1805 focusTextInput(textField?: React.ElementRef<HostComponent<unknown>>): void;
1806
1807 /**
1808 * @param textField ref of the text field to focus
1809 * Unfocuses the specified text field
1810 * noop if it wasn't focused
1811 */
1812 blurTextInput(textField?: React.ElementRef<HostComponent<unknown>>): void;
1813}
1814
1815/**
1816 * @see https://reactnative.dev/docs/textinput#methods
1817 */
1818declare class TextInputComponent extends React.Component<TextInputProps> {}
1819declare const TextInputBase: Constructor<NativeMethods> & Constructor<TimerMixin> & typeof TextInputComponent;
1820export class TextInput extends TextInputBase {
1821 /**
1822 * Access the current focus state.
1823 */
1824 static State: TextInputState;
1825
1826 /**
1827 * Returns if the input is currently focused.
1828 */
1829 isFocused: () => boolean;
1830
1831 /**
1832 * Removes all text from the input.
1833 */
1834 clear: () => void;
1835}
1836
1837/**
1838 * Gesture recognition on mobile devices is much more complicated than web.
1839 * A touch can go through several phases as the app determines what the user's intention is.
1840 * For example, the app needs to determine if the touch is scrolling, sliding on a widget, or tapping.
1841 * This can even change during the duration of a touch. There can also be multiple simultaneous touches.
1842 *
1843 * The touch responder system is needed to allow components to negotiate these touch interactions
1844 * without any additional knowledge about their parent or child components.
1845 * This system is implemented in ResponderEventPlugin.js, which contains further details and documentation.
1846 *
1847 * Best Practices
1848 * Users can feel huge differences in the usability of web apps vs. native, and this is one of the big causes.
1849 * Every action should have the following attributes:
1850 * Feedback/highlighting- show the user what is handling their touch, and what will happen when they release the gesture
1851 * Cancel-ability- when making an action, the user should be able to abort it mid-touch by dragging their finger away
1852 *
1853 * These features make users more comfortable while using an app,
1854 * because it allows people to experiment and interact without fear of making mistakes.
1855 *
1856 * TouchableHighlight and Touchable*
1857 * The responder system can be complicated to use.
1858 * So we have provided an abstract Touchable implementation for things that should be "tappable".
1859 * This uses the responder system and allows you to easily configure tap interactions declaratively.
1860 * Use TouchableHighlight anywhere where you would use a button or link on web.
1861 */
1862export interface GestureResponderHandlers {
1863 /**
1864 * A view can become the touch responder by implementing the correct negotiation methods.
1865 * There are two methods to ask the view if it wants to become responder:
1866 */
1867
1868 /**
1869 * Does this view want to become responder on the start of a touch?
1870 */
1871 onStartShouldSetResponder?: ((event: GestureResponderEvent) => boolean) | undefined;
1872
1873 /**
1874 * Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?
1875 */
1876 onMoveShouldSetResponder?: ((event: GestureResponderEvent) => boolean) | undefined;
1877
1878 /**
1879 * If the View returns true and attempts to become the responder, one of the following will happen:
1880 */
1881
1882 onResponderEnd?: ((event: GestureResponderEvent) => void) | undefined;
1883
1884 /**
1885 * The View is now responding for touch events.
1886 * This is the time to highlight and show the user what is happening
1887 */
1888 onResponderGrant?: ((event: GestureResponderEvent) => void) | undefined;
1889
1890 /**
1891 * Something else is the responder right now and will not release it
1892 */
1893 onResponderReject?: ((event: GestureResponderEvent) => void) | undefined;
1894
1895 /**
1896 * If the view is responding, the following handlers can be called:
1897 */
1898
1899 /**
1900 * The user is moving their finger
1901 */
1902 onResponderMove?: ((event: GestureResponderEvent) => void) | undefined;
1903
1904 /**
1905 * Fired at the end of the touch, ie "touchUp"
1906 */
1907 onResponderRelease?: ((event: GestureResponderEvent) => void) | undefined;
1908
1909 onResponderStart?: ((event: GestureResponderEvent) => void) | undefined;
1910
1911 /**
1912 * Something else wants to become responder.
1913 * Should this view release the responder? Returning true allows release
1914 */
1915 onResponderTerminationRequest?: ((event: GestureResponderEvent) => boolean) | undefined;
1916
1917 /**
1918 * The responder has been taken from the View.
1919 * Might be taken by other views after a call to onResponderTerminationRequest,
1920 * or might be taken by the OS without asking (happens with control center/ notification center on iOS)
1921 */
1922 onResponderTerminate?: ((event: GestureResponderEvent) => void) | undefined;
1923
1924 /**
1925 * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
1926 * where the deepest node is called first.
1927 * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
1928 * This is desirable in most cases, because it makes sure all controls and buttons are usable.
1929 *
1930 * However, sometimes a parent will want to make sure that it becomes responder.
1931 * This can be handled by using the capture phase.
1932 * Before the responder system bubbles up from the deepest component,
1933 * it will do a capture phase, firing on*ShouldSetResponderCapture.
1934 * So if a parent View wants to prevent the child from becoming responder on a touch start,
1935 * it should have a onStartShouldSetResponderCapture handler which returns true.
1936 */
1937 onStartShouldSetResponderCapture?: ((event: GestureResponderEvent) => boolean) | undefined;
1938
1939 /**
1940 * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
1941 * where the deepest node is called first.
1942 * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
1943 * This is desirable in most cases, because it makes sure all controls and buttons are usable.
1944 *
1945 * However, sometimes a parent will want to make sure that it becomes responder.
1946 * This can be handled by using the capture phase.
1947 * Before the responder system bubbles up from the deepest component,
1948 * it will do a capture phase, firing on*ShouldSetResponderCapture.
1949 * So if a parent View wants to prevent the child from becoming responder on a touch start,
1950 * it should have a onStartShouldSetResponderCapture handler which returns true.
1951 */
1952 onMoveShouldSetResponderCapture?: ((event: GestureResponderEvent) => boolean) | undefined;
1953}
1954
1955/**
1956 * @see https://reactnative.dev/docs/view#style
1957 * @see https://github.com/facebook/react-native/blob/master/Libraries/Components/View/ViewStylePropTypes.js
1958 */
1959export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
1960 backfaceVisibility?: 'visible' | 'hidden' | undefined;
1961 backgroundColor?: ColorValue | undefined;
1962 borderBottomColor?: ColorValue | undefined;
1963 borderBottomEndRadius?: number | undefined;
1964 borderBottomLeftRadius?: number | undefined;
1965 borderBottomRightRadius?: number | undefined;
1966 borderBottomStartRadius?: number | undefined;
1967 borderBottomWidth?: number | undefined;
1968 borderColor?: ColorValue | undefined;
1969 borderEndColor?: ColorValue | undefined;
1970 borderLeftColor?: ColorValue | undefined;
1971 borderLeftWidth?: number | undefined;
1972 borderRadius?: number | undefined;
1973 borderRightColor?: ColorValue | undefined;
1974 borderRightWidth?: number | undefined;
1975 borderStartColor?: ColorValue | undefined;
1976 borderStyle?: 'solid' | 'dotted' | 'dashed' | undefined;
1977 borderTopColor?: ColorValue | undefined;
1978 borderTopEndRadius?: number | undefined;
1979 borderTopLeftRadius?: number | undefined;
1980 borderTopRightRadius?: number | undefined;
1981 borderTopStartRadius?: number | undefined;
1982 borderTopWidth?: number | undefined;
1983 borderWidth?: number | undefined;
1984 opacity?: number | undefined;
1985 testID?: string | undefined;
1986 /**
1987 * Sets the elevation of a view, using Android's underlying
1988 * [elevation API](https://developer.android.com/training/material/shadows-clipping.html#Elevation).
1989 * This adds a drop shadow to the item and affects z-order for overlapping views.
1990 * Only supported on Android 5.0+, has no effect on earlier versions.
1991 *
1992 * @platform android
1993 */
1994 elevation?: number | undefined;
1995}
1996
1997export type TVParallaxProperties = {
1998 /**
1999 * If true, parallax effects are enabled. Defaults to true.
2000 */
2001 enabled?: boolean | undefined;
2002
2003 /**
2004 * Defaults to 2.0.
2005 */
2006 shiftDistanceX?: number | undefined;
2007
2008 /**
2009 * Defaults to 2.0.
2010 */
2011 shiftDistanceY?: number | undefined;
2012
2013 /**
2014 * Defaults to 0.05.
2015 */
2016 tiltAngle?: number | undefined;
2017
2018 /**
2019 * Defaults to 1.0
2020 */
2021 magnification?: number | undefined;
2022
2023 /**
2024 * Defaults to 1.0
2025 */
2026 pressMagnification?: number | undefined;
2027
2028 /**
2029 * Defaults to 0.3
2030 */
2031 pressDuration?: number | undefined;
2032
2033 /**
2034 * Defaults to 0.3
2035 */
2036 pressDelay?: number | undefined;
2037};
2038
2039export interface TVViewPropsIOS {
2040 /**
2041 * *(Apple TV only)* When set to true, this view will be focusable
2042 * and navigable using the Apple TV remote.
2043 *
2044 * @platform ios
2045 */
2046 isTVSelectable?: boolean | undefined;
2047
2048 /**
2049 * *(Apple TV only)* May be set to true to force the Apple TV focus engine to move focus to this view.
2050 *
2051 * @platform ios
2052 */
2053 hasTVPreferredFocus?: boolean | undefined;
2054
2055 /**
2056 * *(Apple TV only)* Object with properties to control Apple TV parallax effects.
2057 *
2058 * @platform ios
2059 */
2060 tvParallaxProperties?: TVParallaxProperties | undefined;
2061
2062 /**
2063 * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0.
2064 *
2065 * @platform ios
2066 */
2067 tvParallaxShiftDistanceX?: number | undefined;
2068
2069 /**
2070 * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0.
2071 *
2072 * @platform ios
2073 */
2074 tvParallaxShiftDistanceY?: number | undefined;
2075
2076 /**
2077 * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 0.05.
2078 *
2079 * @platform ios
2080 */
2081 tvParallaxTiltAngle?: number | undefined;
2082
2083 /**
2084 * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 1.0.
2085 *
2086 * @platform ios
2087 */
2088 tvParallaxMagnification?: number | undefined;
2089}
2090
2091export interface ViewPropsIOS extends TVViewPropsIOS {
2092 /**
2093 * Whether this view should be rendered as a bitmap before compositing.
2094 *
2095 * On iOS, this is useful for animations and interactions that do not modify this component's dimensions nor its children;
2096 * for example, when translating the position of a static view, rasterization allows the renderer to reuse a cached bitmap of a static view
2097 * and quickly composite it during each frame.
2098 *
2099 * Rasterization incurs an off-screen drawing pass and the bitmap consumes memory.
2100 * Test and measure when using this property.
2101 */
2102 shouldRasterizeIOS?: boolean | undefined;
2103}
2104
2105export interface ViewPropsAndroid {
2106 /**
2107 * Views that are only used to layout their children or otherwise don't draw anything
2108 * may be automatically removed from the native hierarchy as an optimization.
2109 * Set this property to false to disable this optimization and ensure that this View exists in the native view hierarchy.
2110 */
2111 collapsable?: boolean | undefined;
2112
2113 /**
2114 * Whether this view needs to rendered offscreen and composited with an alpha in order to preserve 100% correct colors and blending behavior.
2115 * The default (false) falls back to drawing the component and its children
2116 * with an alpha applied to the paint used to draw each element instead of rendering the full component offscreen and compositing it back with an alpha value.
2117 * This default may be noticeable and undesired in the case where the View you are setting an opacity on
2118 * has multiple overlapping elements (e.g. multiple overlapping Views, or text and a background).
2119 *
2120 * Rendering offscreen to preserve correct alpha behavior is extremely expensive
2121 * and hard to debug for non-native developers, which is why it is not turned on by default.
2122 * If you do need to enable this property for an animation,
2123 * consider combining it with renderToHardwareTextureAndroid if the view contents are static (i.e. it doesn't need to be redrawn each frame).
2124 * If that property is enabled, this View will be rendered off-screen once,
2125 * saved in a hardware texture, and then composited onto the screen with an alpha each frame without having to switch rendering targets on the GPU.
2126 */
2127 needsOffscreenAlphaCompositing?: boolean | undefined;
2128
2129 /**
2130 * Whether this view should render itself (and all of its children) into a single hardware texture on the GPU.
2131 *
2132 * On Android, this is useful for animations and interactions that only modify opacity, rotation, translation, and/or scale:
2133 * in those cases, the view doesn't have to be redrawn and display lists don't need to be re-executed. The texture can just be
2134 * re-used and re-composited with different parameters. The downside is that this can use up limited video memory, so this prop should be set back to false at the end of the interaction/animation.
2135 */
2136 renderToHardwareTextureAndroid?: boolean | undefined;
2137
2138 /**
2139 * Whether this `View` should be focusable with a non-touch input device, eg. receive focus with a hardware keyboard.
2140 */
2141 focusable?: boolean | undefined;
2142}
2143
2144type Falsy = undefined | null | false;
2145interface RecursiveArray<T> extends Array<T | ReadonlyArray<T> | RecursiveArray<T>> {}
2146/** Keep a brand of 'T' so that calls to `StyleSheet.flatten` can take `RegisteredStyle<T>` and return `T`. */
2147type RegisteredStyle<T> = number & { __registeredStyleBrand: T };
2148export type StyleProp<T> = T | RegisteredStyle<T> | RecursiveArray<T | RegisteredStyle<T> | Falsy> | Falsy;
2149
2150/**
2151 * @see https://reactnative.dev/docs/accessibility#accessibility-properties
2152 */
2153export interface AccessibilityProps extends AccessibilityPropsAndroid, AccessibilityPropsIOS {
2154 /**
2155 * When true, indicates that the view is an accessibility element.
2156 * By default, all the touchable elements are accessible.
2157 */
2158 accessible?: boolean | undefined;
2159
2160 /**
2161 * Provides an array of custom actions available for accessibility.
2162 */
2163 accessibilityActions?: ReadonlyArray<AccessibilityActionInfo> | undefined;
2164
2165 /**
2166 * Overrides the text that's read by the screen reader when the user interacts with the element. By default, the
2167 * label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
2168 */
2169 accessibilityLabel?: string | undefined;
2170
2171 /**
2172 * Accessibility Role tells a person using either VoiceOver on iOS or TalkBack on Android the type of element that is focused on.
2173 */
2174 accessibilityRole?: AccessibilityRole | undefined;
2175 /**
2176 * Accessibility State tells a person using either VoiceOver on iOS or TalkBack on Android the state of the element currently focused on.
2177 */
2178 accessibilityState?: AccessibilityState | undefined;
2179 /**
2180 * An accessibility hint helps users understand what will happen when they perform an action on the accessibility element when that result is not obvious from the accessibility label.
2181 */
2182 accessibilityHint?: string | undefined;
2183 /**
2184 * Represents the current value of a component. It can be a textual description of a component's value, or for range-based components, such as sliders and progress bars,
2185 * it contains range information (minimum, current, and maximum).
2186 */
2187 accessibilityValue?: AccessibilityValue | undefined;
2188
2189 /**
2190 * When `accessible` is true, the system will try to invoke this function when the user performs an accessibility custom action.
2191 */
2192 onAccessibilityAction?: ((event: AccessibilityActionEvent) => void) | undefined;
2193}
2194
2195export type AccessibilityActionInfo = Readonly<{
2196 name: AccessibilityActionName | string;
2197 label?: string | undefined;
2198}>;
2199
2200export type AccessibilityActionName =
2201 /**
2202 * Generated when a screen reader user double taps the component.
2203 */
2204 | 'activate'
2205 /**
2206 * Generated when a screen reader user increments an adjustable component.
2207 */
2208 | 'increment'
2209 /**
2210 * Generated when a screen reader user decrements an adjustable component.
2211 */
2212 | 'decrement'
2213 /**
2214 * Generated when a TalkBack user places accessibility focus on the component and double taps and holds one finger on the screen.
2215 * @platform android
2216 */
2217 | 'longpress'
2218 /**
2219 * Generated when a VoiceOver user places focus on or inside the component and double taps with two fingers.
2220 * @platform ios
2221 * */
2222 | 'magicTap'
2223 /**
2224 * Generated when a VoiceOver user places focus on or inside the component and performs a two finger scrub gesture (left, right, left).
2225 * @platform ios
2226 * */
2227 | 'escape';
2228
2229export type AccessibilityActionEvent = NativeSyntheticEvent<
2230 Readonly<{
2231 actionName: string;
2232 }>
2233>;
2234
2235export interface AccessibilityState {
2236 /**
2237 * When true, informs accessible tools if the element is disabled
2238 */
2239 disabled?: boolean | undefined;
2240 /**
2241 * When true, informs accessible tools if the element is selected
2242 */
2243 selected?: boolean | undefined;
2244 /**
2245 * For items like Checkboxes and Toggle switches, reports their state to accessible tools
2246 */
2247 checked?: boolean | 'mixed' | undefined;
2248 /**
2249 * When present, informs accessible tools if the element is busy
2250 */
2251 busy?: boolean | undefined;
2252 /**
2253 * When present, informs accessible tools the element is expanded or collapsed
2254 */
2255 expanded?: boolean | undefined;
2256}
2257
2258export interface AccessibilityValue {
2259 /**
2260 * The minimum value of this component's range. (should be an integer)
2261 */
2262 min?: number | undefined;
2263
2264 /**
2265 * The maximum value of this component's range. (should be an integer)
2266 */
2267 max?: number | undefined;
2268
2269 /**
2270 * The current value of this component's range. (should be an integer)
2271 */
2272 now?: number | undefined;
2273
2274 /**
2275 * A textual description of this component's value. (will override minimum, current, and maximum if set)
2276 */
2277 text?: string | undefined;
2278}
2279
2280export type AccessibilityRole =
2281 | 'none'
2282 | 'button'
2283 | 'togglebutton'
2284 | 'link'
2285 | 'search'
2286 | 'image'
2287 | 'keyboardkey'
2288 | 'text'
2289 | 'adjustable'
2290 | 'imagebutton'
2291 | 'header'
2292 | 'summary'
2293 | 'alert'
2294 | 'checkbox'
2295 | 'combobox'
2296 | 'menu'
2297 | 'menubar'
2298 | 'menuitem'
2299 | 'progressbar'
2300 | 'radio'
2301 | 'radiogroup'
2302 | 'scrollbar'
2303 | 'spinbutton'
2304 | 'switch'
2305 | 'tab'
2306 | 'tabbar'
2307 | 'tablist'
2308 | 'timer'
2309 | 'list'
2310 | 'toolbar';
2311
2312export interface AccessibilityPropsAndroid {
2313 /**
2314 * Indicates to accessibility services whether the user should be notified when this view changes.
2315 * Works for Android API >= 19 only.
2316 * See http://developer.android.com/reference/android/view/View.html#attr_android:accessibilityLiveRegion for references.
2317 * @platform android
2318 */
2319 accessibilityLiveRegion?: 'none' | 'polite' | 'assertive' | undefined;
2320
2321 /**
2322 * Controls how view is important for accessibility which is if it fires accessibility events
2323 * and if it is reported to accessibility services that query the screen.
2324 * Works for Android only. See http://developer.android.com/reference/android/R.attr.html#importantForAccessibility for references.
2325 *
2326 * Possible values:
2327 * 'auto' - The system determines whether the view is important for accessibility - default (recommended).
2328 * 'yes' - The view is important for accessibility.
2329 * 'no' - The view is not important for accessibility.
2330 * 'no-hide-descendants' - The view is not important for accessibility, nor are any of its descendant views.
2331 */
2332 importantForAccessibility?: 'auto' | 'yes' | 'no' | 'no-hide-descendants' | undefined;
2333}
2334
2335export interface AccessibilityPropsIOS {
2336 /**
2337 * A Boolean value indicating whether the accessibility elements contained within this accessibility element
2338 * are hidden to the screen reader.
2339 * @platform ios
2340 */
2341 accessibilityElementsHidden?: boolean | undefined;
2342
2343 /**
2344 * A Boolean value indicating whether VoiceOver should ignore the elements within views that are siblings of the receiver.
2345 * @platform ios
2346 */
2347 accessibilityViewIsModal?: boolean | undefined;
2348
2349 /**
2350 * When accessibile is true, the system will invoke this function when the user performs the escape gesture (scrub with two fingers).
2351 * @platform ios
2352 */
2353 onAccessibilityEscape?: (() => void) | undefined;
2354
2355 /**
2356 * When `accessible` is true, the system will try to invoke this function when the user performs accessibility tap gesture.
2357 * @platform ios
2358 */
2359 onAccessibilityTap?: (() => void) | undefined;
2360
2361 /**
2362 * When accessible is true, the system will invoke this function when the user performs the magic tap gesture.
2363 * @platform ios
2364 */
2365 onMagicTap?: (() => void) | undefined;
2366
2367 /**
2368 * https://reactnative.dev/docs/accessibility#accessibilityignoresinvertcolorsios
2369 * @platform ios
2370 */
2371 accessibilityIgnoresInvertColors?: boolean | undefined;
2372}
2373
2374/**
2375 * @see https://reactnative.dev/docs/view#props
2376 */
2377export interface ViewProps
2378 extends ViewPropsAndroid,
2379 ViewPropsIOS,
2380 GestureResponderHandlers,
2381 Touchable,
2382 AccessibilityProps {
2383 children?: React.ReactNode;
2384 /**
2385 * This defines how far a touch event can start away from the view.
2386 * Typical interface guidelines recommend touch targets that are at least
2387 * 30 - 40 points/density-independent pixels. If a Touchable view has
2388 * a height of 20 the touchable height can be extended to 40 with
2389 * hitSlop={{top: 10, bottom: 10, left: 0, right: 0}}
2390 * NOTE The touch area never extends past the parent view bounds and
2391 * the Z-index of sibling views always takes precedence if a touch
2392 * hits two overlapping views.
2393 */
2394 hitSlop?: Insets | undefined;
2395
2396 /**
2397 * Invoked on mount and layout changes with
2398 *
2399 * {nativeEvent: { layout: {x, y, width, height}}}.
2400 */
2401 onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
2402
2403 /**
2404 *
2405 * In the absence of auto property, none is much like CSS's none value. box-none is as if you had applied the CSS class:
2406 *
2407 * .box-none {
2408 * pointer-events: none;
2409 * }
2410 * .box-none * {
2411 * pointer-events: all;
2412 * }
2413 *
2414 * box-only is the equivalent of
2415 *
2416 * .box-only {
2417 * pointer-events: all;
2418 * }
2419 * .box-only * {
2420 * pointer-events: none;
2421 * }
2422 *
2423 * But since pointerEvents does not affect layout/appearance, and we are already deviating from the spec by adding additional modes,
2424 * we opt to not include pointerEvents on style. On some platforms, we would need to implement it as a className anyways. Using style or not is an implementation detail of the platform.
2425 */
2426 pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined;
2427
2428 /**
2429 *
2430 * This is a special performance property exposed by RCTView and is useful for scrolling content when there are many subviews,
2431 * most of which are offscreen. For this property to be effective, it must be applied to a view that contains many subviews that extend outside its bound.
2432 * The subviews must also have overflow: hidden, as should the containing view (or one of its superviews).
2433 */
2434 removeClippedSubviews?: boolean | undefined;
2435
2436 style?: StyleProp<ViewStyle> | undefined;
2437
2438 /**
2439 * Used to locate this view in end-to-end tests.
2440 */
2441 testID?: string | undefined;
2442
2443 /**
2444 * Used to reference react managed views from native code.
2445 */
2446 nativeID?: string | undefined;
2447}
2448
2449/**
2450 * The most fundamental component for building UI, View is a container that supports layout with flexbox, style, some touch handling,
2451 * and accessibility controls, and is designed to be nested inside other views and to have 0 to many children of any type.
2452 * View maps directly to the native view equivalent on whatever platform React is running on,
2453 * whether that is a UIView, <div>, android.view, etc.
2454 */
2455declare class ViewComponent extends React.Component<ViewProps> {}
2456declare const ViewBase: Constructor<NativeMethods> & typeof ViewComponent;
2457export class View extends ViewBase {
2458 /**
2459 * Is 3D Touch / Force Touch available (i.e. will touch events include `force`)
2460 * @platform ios
2461 */
2462 static forceTouchAvailable: boolean;
2463}
2464
2465/**
2466 * @see https://reactnative.dev/docs/viewpagerandroid#props
2467 */
2468
2469export interface ViewPagerAndroidOnPageScrollEventData {
2470 position: number;
2471 offset: number;
2472}
2473
2474export interface ViewPagerAndroidOnPageSelectedEventData {
2475 position: number;
2476}
2477
2478export interface ViewPagerAndroidProps extends ViewProps {
2479 /**
2480 * Index of initial page that should be selected. Use `setPage` method to
2481 * update the page, and `onPageSelected` to monitor page changes
2482 */
2483 initialPage?: number | undefined;
2484
2485 /**
2486 * When false, the content does not scroll.
2487 * The default value is true.
2488 */
2489 scrollEnabled?: boolean | undefined;
2490
2491 /**
2492 * Executed when transitioning between pages (ether because of animation for
2493 * the requested page change or when user is swiping/dragging between pages)
2494 * The `event.nativeEvent` object for this callback will carry following data:
2495 * - position - index of first page from the left that is currently visible
2496 * - offset - value from range [0,1) describing stage between page transitions.
2497 * Value x means that (1 - x) fraction of the page at "position" index is
2498 * visible, and x fraction of the next page is visible.
2499 */
2500 onPageScroll?: ((event: NativeSyntheticEvent<ViewPagerAndroidOnPageScrollEventData>) => void) | undefined;
2501
2502 /**
2503 * This callback will be called once ViewPager finish navigating to selected page
2504 * (when user swipes between pages). The `event.nativeEvent` object passed to this
2505 * callback will have following fields:
2506 * - position - index of page that has been selected
2507 */
2508 onPageSelected?: ((event: NativeSyntheticEvent<ViewPagerAndroidOnPageSelectedEventData>) => void) | undefined;
2509
2510 /**
2511 * Function called when the page scrolling state has changed.
2512 * The page scrolling state can be in 3 states:
2513 * - idle, meaning there is no interaction with the page scroller happening at the time
2514 * - dragging, meaning there is currently an interaction with the page scroller
2515 * - settling, meaning that there was an interaction with the page scroller, and the
2516 * page scroller is now finishing it's closing or opening animation
2517 */
2518 onPageScrollStateChanged?: ((state: 'Idle' | 'Dragging' | 'Settling') => void) | undefined;
2519
2520 /**
2521 * Determines whether the keyboard gets dismissed in response to a drag.
2522 * - 'none' (the default), drags do not dismiss the keyboard.
2523 * - 'on-drag', the keyboard is dismissed when a drag begins.
2524 */
2525 keyboardDismissMode?: 'none' | 'on-drag' | undefined;
2526
2527 /**
2528 * Blank space to show between pages. This is only visible while scrolling, pages are still
2529 * edge-to-edge.
2530 */
2531 pageMargin?: number | undefined;
2532}
2533
2534declare class ViewPagerAndroidComponent extends React.Component<ViewPagerAndroidProps> {}
2535declare const ViewPagerAndroidBase: Constructor<NativeMethods> & typeof ViewPagerAndroidComponent;
2536
2537/**
2538 * ViewPagerAndroid has been removed from React Native.
2539 * It can now be installed and imported from `@react-native-community/viewpager` instead of 'react-native'.
2540 * @see https://github.com/react-native-community/react-native-viewpager
2541 * @deprecated
2542 */
2543export class ViewPagerAndroid extends ViewPagerAndroidBase {
2544 /**
2545 * A helper function to scroll to a specific page in the ViewPager.
2546 * The transition between pages will be animated.
2547 */
2548 setPage(selectedPage: number): void;
2549
2550 /**
2551 * A helper function to scroll to a specific page in the ViewPager.
2552 * The transition between pages will *not* be animated.
2553 */
2554 setPageWithoutAnimation(selectedPage: number): void;
2555}
2556
2557/**
2558 * It is a component to solve the common problem of views that need to move out of the way of the virtual keyboard.
2559 * It can automatically adjust either its position or bottom padding based on the position of the keyboard.
2560 */
2561declare class KeyboardAvoidingViewComponent extends React.Component<KeyboardAvoidingViewProps> {}
2562declare const KeyboardAvoidingViewBase: Constructor<TimerMixin> & typeof KeyboardAvoidingViewComponent;
2563export class KeyboardAvoidingView extends KeyboardAvoidingViewBase {}
2564
2565export interface KeyboardAvoidingViewProps extends ViewProps {
2566 behavior?: 'height' | 'position' | 'padding' | undefined;
2567
2568 /**
2569 * The style of the content container(View) when behavior is 'position'.
2570 */
2571 contentContainerStyle?: StyleProp<ViewStyle> | undefined;
2572
2573 /**
2574 * This is the distance between the top of the user screen and the react native view,
2575 * may be non-zero in some use cases.
2576 */
2577 keyboardVerticalOffset?: number | undefined;
2578
2579 /**
2580 * Enables or disables the KeyboardAvoidingView.
2581 *
2582 * Default is true
2583 */
2584 enabled?: boolean | undefined;
2585}
2586
2587/**
2588 * @see https://reactnative.dev/docs/segmentedcontrolios
2589 * @see SegmentedControlIOS.ios.js
2590 */
2591export interface NativeSegmentedControlIOSChangeEvent extends TargetedEvent {
2592 value: string;
2593 selectedSegmentIndex: number;
2594}
2595
2596export interface SegmentedControlIOSProps extends ViewProps {
2597 /**
2598 * If false the user won't be able to interact with the control. Default value is true.
2599 */
2600 enabled?: boolean | undefined;
2601
2602 /**
2603 * If true, then selecting a segment won't persist visually.
2604 * The onValueChange callback will still work as expected.
2605 */
2606 momentary?: boolean | undefined;
2607
2608 /**
2609 * Callback that is called when the user taps a segment;
2610 * passes the event as an argument
2611 */
2612 onChange?: ((event: NativeSyntheticEvent<NativeSegmentedControlIOSChangeEvent>) => void) | undefined;
2613
2614 /**
2615 * Callback that is called when the user taps a segment; passes the segment's value as an argument
2616 */
2617 onValueChange?: ((value: string) => void) | undefined;
2618
2619 /**
2620 * The index in props.values of the segment to be (pre)selected.
2621 */
2622 selectedIndex?: number | undefined;
2623
2624 /**
2625 * Accent color of the control.
2626 */
2627 tintColor?: ColorValue | undefined;
2628
2629 /**
2630 * The labels for the control's segment buttons, in order.
2631 */
2632 values?: string[] | undefined;
2633}
2634
2635/**
2636 * Renders nested content and automatically applies paddings reflect the portion of the view
2637 * that is not covered by navigation bars, tab bars, toolbars, and other ancestor views.
2638 * Moreover, and most importantly, Safe Area's paddings reflect physical limitation of the screen,
2639 * such as rounded corners or camera notches (aka sensor housing area on iPhone X).
2640 */
2641declare class SafeAreaViewComponent extends React.Component<ViewProps> {}
2642declare const SafeAreaViewBase: Constructor<NativeMethods> & typeof SafeAreaViewComponent;
2643export class SafeAreaView extends SafeAreaViewBase {}
2644
2645/**
2646 * A component which enables customization of the keyboard input accessory view on iOS. The input accessory view is
2647 * displayed above the keyboard whenever a TextInput has focus. This component can be used to create custom toolbars.
2648 *
2649 * To use this component wrap your custom toolbar with the InputAccessoryView component, and set a nativeID. Then, pass
2650 * that nativeID as the inputAccessoryViewID of whatever TextInput you desire.
2651 */
2652export class InputAccessoryView extends React.Component<InputAccessoryViewProps> {}
2653
2654export interface InputAccessoryViewProps {
2655 backgroundColor?: ColorValue | undefined;
2656
2657 children?: React.ReactNode;
2658
2659 /**
2660 * An ID which is used to associate this InputAccessoryView to specified TextInput(s).
2661 */
2662 nativeID?: string | undefined;
2663
2664 style?: StyleProp<ViewStyle> | undefined;
2665}
2666
2667/**
2668 * Use `SegmentedControlIOS` to render a UISegmentedControl iOS.
2669 *
2670 * #### Programmatically changing selected index
2671 *
2672 * The selected index can be changed on the fly by assigning the
2673 * selectIndex prop to a state variable, then changing that variable.
2674 * Note that the state variable would need to be updated as the user
2675 * selects a value and changes the index, as shown in the example below.
2676 *
2677 * ````
2678 * <SegmentedControlIOS
2679 * values={['One', 'Two']}
2680 * selectedIndex={this.state.selectedIndex}
2681 * onChange={(event) => {
2682 * this.setState({selectedIndex: event.nativeEvent.selectedSegmentIndex});
2683 * }}
2684 * />
2685 * ````
2686 */
2687declare class SegmentedControlIOSComponent extends React.Component<SegmentedControlIOSProps> {}
2688declare const SegmentedControlIOSBase: Constructor<NativeMethods> & typeof SegmentedControlIOSComponent;
2689
2690/**
2691 * SegmentedControlIOS has been extracted from react-native core and will be removed in a future release.
2692 * It can now be installed and imported from `@react-native-community/segmented-control` instead of 'react-native'.
2693 * @see https://github.com/react-native-community/segmented-control
2694 * @deprecated
2695 */
2696export class SegmentedControlIOS extends SegmentedControlIOSBase {}
2697
2698export interface NavigatorIOSProps {
2699 /**
2700 * The default background color of the navigation bar.
2701 */
2702 barTintColor?: ColorValue | undefined;
2703
2704 /**
2705 * NavigatorIOS uses "route" objects to identify child views, their props, and navigation bar configuration.
2706 * "push" and all the other navigation operations expect routes to be like this
2707 */
2708 initialRoute: Route;
2709
2710 /**
2711 * The default wrapper style for components in the navigator.
2712 * A common use case is to set the backgroundColor for every page
2713 */
2714 itemWrapperStyle?: StyleProp<ViewStyle> | undefined;
2715
2716 /**
2717 * Boolean value that indicates whether the interactive pop gesture is
2718 * enabled. This is useful for enabling/disabling the back swipe navigation
2719 * gesture.
2720 *
2721 * If this prop is not provided, the default behavior is for the back swipe
2722 * gesture to be enabled when the navigation bar is shown and disabled when
2723 * the navigation bar is hidden. Once you've provided the
2724 * `interactivePopGestureEnabled` prop, you can never restore the default
2725 * behavior.
2726 */
2727 interactivePopGestureEnabled?: boolean | undefined;
2728
2729 /**
2730 * A Boolean value that indicates whether the navigation bar is hidden
2731 */
2732 navigationBarHidden?: boolean | undefined;
2733
2734 /**
2735 * A Boolean value that indicates whether to hide the 1px hairline shadow
2736 */
2737 shadowHidden?: boolean | undefined;
2738
2739 /**
2740 * The color used for buttons in the navigation bar
2741 */
2742 tintColor?: ColorValue | undefined;
2743
2744 /**
2745 * The text color of the navigation bar title
2746 */
2747 titleTextColor?: ColorValue | undefined;
2748
2749 /**
2750 * A Boolean value that indicates whether the navigation bar is translucent
2751 */
2752 translucent?: boolean | undefined;
2753
2754 /**
2755 * NOT IN THE DOC BUT IN THE EXAMPLES
2756 */
2757 style?: StyleProp<ViewStyle> | undefined;
2758}
2759
2760/**
2761 * A navigator is an object of navigation functions that a view can call.
2762 * It is passed as a prop to any component rendered by NavigatorIOS.
2763 *
2764 * Navigator functions are also available on the NavigatorIOS component:
2765 *
2766 * @see https://reactnative.dev/docs/navigatorios#navigator
2767 */
2768export class NavigatorIOS extends React.Component<NavigatorIOSProps> {
2769 /**
2770 * Navigate forward to a new route
2771 */
2772 push: (route: Route) => void;
2773
2774 /**
2775 * Go back one page
2776 */
2777 pop: () => void;
2778
2779 /**
2780 * Go back N pages at once. When N=1, behavior matches pop()
2781 */
2782 popN: (n: number) => void;
2783
2784 /**
2785 * Replace the route for the current page and immediately load the view for the new route
2786 */
2787 replace: (route: Route) => void;
2788
2789 /**
2790 * Replace the route/view for the previous page
2791 */
2792 replacePrevious: (route: Route) => void;
2793
2794 /**
2795 * Replaces the previous route/view and transitions back to it
2796 */
2797 replacePreviousAndPop: (route: Route) => void;
2798
2799 /**
2800 * Replaces the top item and popToTop
2801 */
2802 resetTo: (route: Route) => void;
2803
2804 /**
2805 * Go back to the item for a particular route object
2806 */
2807 popToRoute(route: Route): void;
2808
2809 /**
2810 * Go back to the top item
2811 */
2812 popToTop(): void;
2813}
2814
2815/**
2816 * @see https://reactnative.dev/docs/activityindicator#props
2817 */
2818export interface ActivityIndicatorProps extends ViewProps {
2819 /**
2820 * Whether to show the indicator (true, the default) or hide it (false).
2821 */
2822 animating?: boolean | undefined;
2823
2824 /**
2825 * The foreground color of the spinner (default is gray).
2826 */
2827 color?: ColorValue | undefined;
2828
2829 /**
2830 * Whether the indicator should hide when not animating (true by default).
2831 */
2832 hidesWhenStopped?: boolean | undefined;
2833
2834 /**
2835 * Size of the indicator.
2836 * Small has a height of 20, large has a height of 36.
2837 *
2838 * enum('small', 'large')
2839 */
2840 size?: number | 'small' | 'large' | undefined;
2841
2842 style?: StyleProp<ViewStyle> | undefined;
2843}
2844
2845declare class ActivityIndicatorComponent extends React.Component<ActivityIndicatorProps> {}
2846declare const ActivityIndicatorBase: Constructor<NativeMethods> & typeof ActivityIndicatorComponent;
2847export class ActivityIndicator extends ActivityIndicatorBase {}
2848
2849/**
2850 * @see https://reactnative.dev/docs/activityindicatorios#props
2851 */
2852export interface ActivityIndicatorIOSProps extends ViewProps {
2853 /**
2854 * Whether to show the indicator (true, the default) or hide it (false).
2855 */
2856 animating?: boolean | undefined;
2857
2858 /**
2859 * The foreground color of the spinner (default is gray).
2860 */
2861 color?: ColorValue | undefined;
2862
2863 /**
2864 * Whether the indicator should hide when not animating (true by default).
2865 */
2866 hidesWhenStopped?: boolean | undefined;
2867
2868 /**
2869 * Invoked on mount and layout changes with
2870 */
2871 onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
2872
2873 /**
2874 * Size of the indicator.
2875 * Small has a height of 20, large has a height of 36.
2876 *
2877 * enum('small', 'large')
2878 */
2879 size?: 'small' | 'large' | undefined;
2880
2881 style?: StyleProp<ViewStyle> | undefined;
2882}
2883
2884export interface DatePickerIOSProps extends ViewProps {
2885 /**
2886 * The currently selected date.
2887 */
2888 date?: Date | null | undefined;
2889
2890 /**
2891 * Provides an initial value that will change when the user starts selecting
2892 * a date. It is useful for simple use-cases where you do not want to deal
2893 * with listening to events and updating the date prop to keep the
2894 * controlled state in sync. The controlled state has known bugs which
2895 * causes it to go out of sync with native. The initialDate prop is intended
2896 * to allow you to have native be source of truth.
2897 */
2898 initialDate?: Date | null | undefined;
2899
2900 /**
2901 * The date picker locale.
2902 */
2903 locale?: string | undefined;
2904
2905 /**
2906 * Maximum date.
2907 * Restricts the range of possible date/time values.
2908 */
2909 maximumDate?: Date | undefined;
2910
2911 /**
2912 * Maximum date.
2913 * Restricts the range of possible date/time values.
2914 */
2915 minimumDate?: Date | undefined;
2916
2917 /**
2918 * enum(1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30)
2919 * The interval at which minutes can be selected.
2920 */
2921 minuteInterval?: 1 | 2 | 3 | 4 | 5 | 6 | 10 | 12 | 15 | 20 | 30 | undefined;
2922
2923 /**
2924 * enum('date', 'time', 'datetime')
2925 * The date picker mode.
2926 */
2927 mode?: 'date' | 'time' | 'datetime' | undefined;
2928
2929 /**
2930 * Date change handler.
2931 * This is called when the user changes the date or time in the UI.
2932 * The first and only argument is a Date object representing the new date and time.
2933 */
2934 onDateChange: (newDate: Date) => void;
2935
2936 /**
2937 * Timezone offset in minutes.
2938 * By default, the date picker will use the device's timezone. With this parameter, it is possible to force a certain timezone offset.
2939 * For instance, to show times in Pacific Standard Time, pass -7 * 60.
2940 */
2941 timeZoneOffsetInMinutes?: number | undefined;
2942
2943 /**
2944 * The date picker style
2945 * This is only available on devices with iOS 14.0 and later.
2946 * 'spinner' is the default style if this prop isn't set.
2947 */
2948 pickerStyle?: 'compact' | 'spinner' | 'inline' | undefined;
2949}
2950
2951declare class DatePickerIOSComponent extends React.Component<DatePickerIOSProps> {}
2952declare const DatePickerIOSBase: Constructor<NativeMethods> & typeof DatePickerIOSComponent;
2953
2954/**
2955 * DatePickerIOS has been merged with DatePickerAndroid and will be removed in a future release.
2956 * It can now be installed and imported from `@react-native-community/datetimepicker` instead of 'react-native'.
2957 * @see https://github.com/react-native-community/datetimepicker
2958 * @deprecated
2959 */
2960export class DatePickerIOS extends DatePickerIOSBase {}
2961
2962export interface DrawerSlideEvent extends NativeSyntheticEvent<NativeTouchEvent> {}
2963
2964/**
2965 * @see DrawerLayoutAndroid.android.js
2966 */
2967export interface DrawerLayoutAndroidProps extends ViewProps {
2968 /**
2969 * Specifies the background color of the drawer. The default value
2970 * is white. If you want to set the opacity of the drawer, use rgba.
2971 * Example:
2972 * return (
2973 * <DrawerLayoutAndroid drawerBackgroundColor="rgba(0,0,0,0.5)">
2974 * </DrawerLayoutAndroid>
2975 *);
2976 */
2977 drawerBackgroundColor?: ColorValue | undefined;
2978
2979 /**
2980 * Specifies the lock mode of the drawer. The drawer can be locked
2981 * in 3 states:
2982 *
2983 * - unlocked (default), meaning that the drawer will respond
2984 * (open/close) to touch gestures.
2985 *
2986 * - locked-closed, meaning that the drawer will stay closed and not
2987 * respond to gestures.
2988 *
2989 * - locked-open, meaning that the drawer will stay opened and
2990 * not respond to gestures. The drawer may still be opened and
2991 * closed programmatically (openDrawer/closeDrawer).
2992 */
2993 drawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open' | undefined;
2994
2995 /**
2996 * Specifies the side of the screen from which the drawer will slide in.
2997 * - 'left' (the default)
2998 * - 'right'
2999 */
3000 drawerPosition?: 'left' | 'right' | undefined;
3001
3002 /**
3003 * Specifies the width of the drawer, more precisely the width of the
3004 * view that be pulled in from the edge of the window.
3005 */
3006 drawerWidth?: number | undefined;
3007
3008 /**
3009 * Determines whether the keyboard gets dismissed in response to a drag.
3010 * - 'none' (the default), drags do not dismiss the keyboard.
3011 * - 'on-drag', the keyboard is dismissed when a drag begins.
3012 */
3013 keyboardDismissMode?: 'none' | 'on-drag' | undefined;
3014
3015 /**
3016 * Function called whenever the navigation view has been closed.
3017 */
3018 onDrawerClose?: (() => void) | undefined;
3019
3020 /**
3021 * Function called whenever the navigation view has been opened.
3022 */
3023 onDrawerOpen?: (() => void) | undefined;
3024
3025 /**
3026 * Function called whenever there is an interaction with the navigation view.
3027 */
3028 onDrawerSlide?: ((event: DrawerSlideEvent) => void) | undefined;
3029
3030 /**
3031 * Function called when the drawer state has changed.
3032 * The drawer can be in 3 states:
3033 * - idle, meaning there is no interaction with the navigation
3034 * view happening at the time
3035 * - dragging, meaning there is currently an interaction with the
3036 * navigation view
3037 * - settling, meaning that there was an interaction with the
3038 * navigation view, and the navigation view is now finishing
3039 * it's closing or opening animation
3040 */
3041 onDrawerStateChanged?: ((event: 'Idle' | 'Dragging' | 'Settling') => void) | undefined;
3042
3043 /**
3044 * The navigation view that will be rendered to the side of the
3045 * screen and can be pulled in.
3046 */
3047 renderNavigationView: () => JSX.Element;
3048
3049 /**
3050 * Make the drawer take the entire screen and draw the background of
3051 * the status bar to allow it to open over the status bar. It will
3052 * only have an effect on API 21+.
3053 */
3054 statusBarBackgroundColor?: ColorValue | undefined;
3055}
3056
3057interface DrawerPosition {
3058 Left: number;
3059 Right: number;
3060}
3061
3062declare class DrawerLayoutAndroidComponent extends React.Component<DrawerLayoutAndroidProps> {}
3063declare const DrawerLayoutAndroidBase: Constructor<NativeMethods> & typeof DrawerLayoutAndroidComponent;
3064export class DrawerLayoutAndroid extends DrawerLayoutAndroidBase {
3065 /**
3066 * drawer's positions.
3067 */
3068 positions: DrawerPosition;
3069
3070 /**
3071 * Opens the drawer.
3072 */
3073 openDrawer(): void;
3074
3075 /**
3076 * Closes the drawer.
3077 */
3078 closeDrawer(): void;
3079}
3080
3081/**
3082 * ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
3083 * It can now be installed and imported from `@react-native-community/progress-bar-android` instead of 'react-native'.
3084 * @see https://github.com/react-native-community/progress-bar-android
3085 * @deprecated
3086 */
3087export interface ProgressBarAndroidProps extends ViewProps {
3088 /**
3089 * Style of the ProgressBar. One of:
3090 Horizontal
3091 Normal (default)
3092 Small
3093 Large
3094 Inverse
3095 SmallInverse
3096 LargeInverse
3097 */
3098 styleAttr?: 'Horizontal' | 'Normal' | 'Small' | 'Large' | 'Inverse' | 'SmallInverse' | 'LargeInverse' | undefined;
3099
3100 /**
3101 * If the progress bar will show indeterminate progress.
3102 * Note that this can only be false if styleAttr is Horizontal.
3103 */
3104 indeterminate?: boolean | undefined;
3105
3106 /**
3107 * The progress value (between 0 and 1).
3108 */
3109 progress?: number | undefined;
3110
3111 /**
3112 * Whether to show the ProgressBar (true, the default) or hide it (false).
3113 */
3114 animating?: boolean | undefined;
3115
3116 /**
3117 * Color of the progress bar.
3118 */
3119 color?: ColorValue | undefined;
3120
3121 /**
3122 * Used to locate this view in end-to-end tests.
3123 */
3124 testID?: string | undefined;
3125}
3126/**
3127 * React component that wraps the Android-only `ProgressBar`. This component is used to indicate
3128 * that the app is loading or there is some activity in the app.
3129 */
3130declare class ProgressBarAndroidComponent extends React.Component<ProgressBarAndroidProps> {}
3131declare const ProgressBarAndroidBase: Constructor<NativeMethods> & typeof ProgressBarAndroidComponent;
3132/**
3133 * ProgressBarAndroid has been extracted from react-native core and will be removed in a future release.
3134 * It can now be installed and imported from `@react-native-community/progress-bar-android` instead of 'react-native'.
3135 * @see https://github.com/react-native-progress-view/progress-bar-android
3136 * @deprecated
3137 */
3138export class ProgressBarAndroid extends ProgressBarAndroidBase {}
3139
3140/**
3141 * @see https://reactnative.dev/docs/progressviewios
3142 * @see ProgressViewIOS.ios.js
3143 */
3144export interface ProgressViewIOSProps extends ViewProps {
3145 /**
3146 * The progress bar style.
3147 */
3148 progressViewStyle?: 'default' | 'bar' | undefined;
3149
3150 /**
3151 * The progress value (between 0 and 1).
3152 */
3153 progress?: number | undefined;
3154
3155 /**
3156 * The tint color of the progress bar itself.
3157 */
3158 progressTintColor?: ColorValue | undefined;
3159
3160 /**
3161 * The tint color of the progress bar track.
3162 */
3163 trackTintColor?: ColorValue | undefined;
3164
3165 /**
3166 * A stretchable image to display as the progress bar.
3167 */
3168 progressImage?: ImageURISource | ImageURISource[] | undefined;
3169
3170 /**
3171 * A stretchable image to display behind the progress bar.
3172 */
3173 trackImage?: ImageURISource | ImageURISource[] | undefined;
3174}
3175declare class ProgressViewIOSComponent extends React.Component<ProgressViewIOSProps> {}
3176declare const ProgressViewIOSBase: Constructor<NativeMethods> & typeof ProgressViewIOSComponent;
3177/**
3178 * ProgressViewIOS has been extracted from react-native core and will be removed in a future release.
3179 * It can now be installed and imported from `@react-native-community/progress-view` instead of 'react-native'.
3180 * @see https://github.com/react-native-community/progress-view
3181 * @deprecated
3182 */
3183export class ProgressViewIOS extends ProgressViewIOSBase {}
3184
3185export interface RefreshControlPropsIOS extends ViewProps {
3186 /**
3187 * The color of the refresh indicator.
3188 */
3189 tintColor?: ColorValue | undefined;
3190
3191 /**
3192 * The title displayed under the refresh indicator.
3193 */
3194 title?: string | undefined;
3195
3196 /**
3197 * Title color.
3198 */
3199 titleColor?: ColorValue | undefined;
3200}
3201
3202export interface RefreshControlPropsAndroid extends ViewProps {
3203 /**
3204 * The colors (at least one) that will be used to draw the refresh indicator.
3205 */
3206 colors?: ColorValue[] | undefined;
3207
3208 /**
3209 * Whether the pull to refresh functionality is enabled.
3210 */
3211 enabled?: boolean | undefined;
3212
3213 /**
3214 * The background color of the refresh indicator.
3215 */
3216 progressBackgroundColor?: ColorValue | undefined;
3217
3218 /**
3219 * Size of the refresh indicator, see RefreshControl.SIZE.
3220 */
3221 size?: number | undefined;
3222
3223 /**
3224 * Progress view top offset
3225 * @platform android
3226 */
3227 progressViewOffset?: number | undefined;
3228}
3229
3230export interface RefreshControlProps extends RefreshControlPropsIOS, RefreshControlPropsAndroid {
3231 /**
3232 * Called when the view starts refreshing.
3233 */
3234 onRefresh?: (() => void) | undefined;
3235
3236 /**
3237 * Whether the view should be indicating an active refresh.
3238 */
3239 refreshing: boolean;
3240}
3241
3242/**
3243 * This component is used inside a ScrollView or ListView to add pull to refresh
3244 * functionality. When the ScrollView is at `scrollY: 0`, swiping down
3245 * triggers an `onRefresh` event.
3246 *
3247 * __Note:__ `refreshing` is a controlled prop, this is why it needs to be set to true
3248 * in the `onRefresh` function otherwise the refresh indicator will stop immediately.
3249 */
3250declare class RefreshControlComponent extends React.Component<RefreshControlProps> {}
3251declare const RefreshControlBase: Constructor<NativeMethods> & typeof RefreshControlComponent;
3252export class RefreshControl extends RefreshControlBase {
3253 static SIZE: Object; // Undocumented
3254}
3255
3256export interface RecyclerViewBackedScrollViewProps extends ScrollViewProps {}
3257
3258/**
3259 * Wrapper around android native recycler view.
3260 *
3261 * It simply renders rows passed as children in a separate recycler view cells
3262 * similarly to how `ScrollView` is doing it. Thanks to the fact that it uses
3263 * native `RecyclerView` though, rows that are out of sight are going to be
3264 * automatically detached (similarly on how this would work with
3265 * `removeClippedSubviews = true` on a `ScrollView.js`).
3266 *
3267 * CAUTION: This is an experimental component and should only be used together
3268 * with javascript implementation of list view (see ListView.js). In order to
3269 * use it pass this component as `renderScrollComponent` to the list view. For
3270 * now only horizontal scrolling is supported.
3271 */
3272declare class RecyclerViewBackedScrollViewComponent extends React.Component<RecyclerViewBackedScrollViewProps> {}
3273declare const RecyclerViewBackedScrollViewBase: Constructor<ScrollResponderMixin> &
3274 typeof RecyclerViewBackedScrollViewComponent;
3275export class RecyclerViewBackedScrollView extends RecyclerViewBackedScrollViewBase {
3276 /**
3277 * A helper function to scroll to a specific point in the scrollview.
3278 * This is currently used to help focus on child textviews, but can also
3279 * be used to quickly scroll to any element we want to focus. Syntax:
3280 *
3281 * scrollResponderScrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true})
3282 *
3283 * Note: The weird argument signature is due to the fact that, for historical reasons,
3284 * the function also accepts separate arguments as an alternative to the options object.
3285 * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
3286 */
3287 scrollTo(y?: number | { x?: number | undefined; y?: number | undefined; animated?: boolean | undefined }, x?: number, animated?: boolean): void;
3288
3289 /**
3290 * Returns a reference to the underlying scroll responder, which supports
3291 * operations like `scrollTo`. All ScrollView-like components should
3292 * implement this method so that they can be composed while providing access
3293 * to the underlying scroll responder's methods.
3294 */
3295 getScrollResponder(): JSX.Element;
3296}
3297
3298export interface SliderPropsAndroid extends ViewProps {
3299 /**
3300 * Color of the foreground switch grip.
3301 */
3302 thumbTintColor?: ColorValue | undefined;
3303}
3304
3305export interface SliderPropsIOS extends ViewProps {
3306 /**
3307 * Assigns a maximum track image. Only static images are supported.
3308 * The leftmost pixel of the image will be stretched to fill the track.
3309 */
3310 maximumTrackImage?: ImageURISource | undefined;
3311
3312 /**
3313 * Assigns a minimum track image. Only static images are supported.
3314 * The rightmost pixel of the image will be stretched to fill the track.
3315 */
3316 minimumTrackImage?: ImageURISource | undefined;
3317
3318 /**
3319 * Sets an image for the thumb. Only static images are supported.
3320 */
3321 thumbImage?: ImageURISource | undefined;
3322
3323 /**
3324 * Assigns a single image for the track. Only static images
3325 * are supported. The center pixel of the image will be stretched
3326 * to fill the track.
3327 */
3328 trackImage?: ImageURISource | undefined;
3329}
3330
3331export interface SliderProps extends SliderPropsIOS, SliderPropsAndroid {
3332 /**
3333 * If true the user won't be able to move the slider.
3334 * Default value is false.
3335 */
3336 disabled?: boolean | undefined;
3337
3338 /**
3339 * The color used for the track to the right of the button.
3340 * Overrides the default blue gradient image.
3341 */
3342 maximumTrackTintColor?: ColorValue | undefined;
3343
3344 /**
3345 * Initial maximum value of the slider. Default value is 1.
3346 */
3347 maximumValue?: number | undefined;
3348
3349 /**
3350 * The color used for the track to the left of the button.
3351 * Overrides the default blue gradient image.
3352 */
3353 minimumTrackTintColor?: ColorValue | undefined;
3354
3355 /**
3356 * Initial minimum value of the slider. Default value is 0.
3357 */
3358 minimumValue?: number | undefined;
3359
3360 /**
3361 * Callback called when the user finishes changing the value (e.g. when the slider is released).
3362 */
3363 onSlidingComplete?: ((value: number) => void) | undefined;
3364
3365 /**
3366 * Callback continuously called while the user is dragging the slider.
3367 */
3368 onValueChange?: ((value: number) => void) | undefined;
3369
3370 /**
3371 * Step value of the slider. The value should be between 0 and (maximumValue - minimumValue). Default value is 0.
3372 */
3373 step?: number | undefined;
3374
3375 /**
3376 * Used to style and layout the Slider. See StyleSheet.js and ViewStylePropTypes.js for more info.
3377 */
3378 style?: StyleProp<ViewStyle> | undefined;
3379
3380 /**
3381 * Used to locate this view in UI automation tests.
3382 */
3383 testID?: string | undefined;
3384
3385 /**
3386 * Initial value of the slider. The value should be between minimumValue
3387 * and maximumValue, which default to 0 and 1 respectively.
3388 * Default value is 0.
3389 * This is not a controlled component, you don't need to update
3390 * the value during dragging.
3391 */
3392 value?: number | undefined;
3393}
3394
3395/**
3396 * A component used to select a single value from a range of values.
3397 */
3398declare class SliderComponent extends React.Component<SliderProps> {}
3399declare const SliderBase: Constructor<NativeMethods> & typeof SliderComponent;
3400/**
3401 * Slider has been extracted from react-native core and will be removed in a future release.
3402 * It can now be installed and imported from `@react-native-community/slider` instead of 'react-native'.
3403 * @see https://github.com/callstack/react-native-slider
3404 * @deprecated
3405 */
3406export class Slider extends SliderBase {}
3407/** SliderIOS has been removed from react-native.
3408 * It can now be installed and imported from `@react-native-community/slider` instead of 'react-native'.
3409 * @see https://github.com/callstack/react-native-slider
3410 * @deprecated
3411 */
3412export type SliderIOS = Slider;
3413
3414/**
3415 * SwitchIOS Component has been removed from react-native in favor of Switch Component
3416 * https://github.com/facebook/react-native/pull/9891/files
3417 * @deprecated see SwitchProps
3418 */
3419export interface SwitchIOSProps extends ViewProps {
3420 /**
3421 * If true the user won't be able to toggle the switch. Default value is false.
3422 */
3423 disabled?: boolean | undefined;
3424
3425 /**
3426 * Background color when the switch is turned on.
3427 */
3428 onTintColor?: ColorValue | undefined;
3429
3430 /**
3431 * Callback that is called when the user toggles the switch.
3432 */
3433 onValueChange?: ((value: boolean) => void) | undefined;
3434
3435 /**
3436 * Background color for the switch round button.
3437 */
3438 thumbTintColor?: ColorValue | undefined;
3439
3440 /**
3441 * Background color when the switch is turned off.
3442 */
3443 tintColor?: ColorValue | undefined;
3444
3445 /**
3446 * The value of the switch, if true the switch will be turned on. Default value is false.
3447 */
3448 value?: boolean | undefined;
3449}
3450
3451/**
3452 * SwitchIOS component has been removed from react-native in favor of Switch component
3453 * https://github.com/facebook/react-native/pull/9891/files
3454 * @deprecated see Switch
3455 */
3456export class SwitchIOS extends React.Component<SwitchIOSProps> {}
3457
3458export type ImageResizeMode = 'cover' | 'contain' | 'stretch' | 'repeat' | 'center';
3459
3460/**
3461 * @see ImageResizeMode.js
3462 */
3463export interface ImageResizeModeStatic {
3464 /**
3465 * contain - The image will be resized such that it will be completely
3466 * visible, contained within the frame of the View.
3467 */
3468 contain: ImageResizeMode;
3469 /**
3470 * cover - The image will be resized such that the entire area of the view
3471 * is covered by the image, potentially clipping parts of the image.
3472 */
3473 cover: ImageResizeMode;
3474 /**
3475 * stretch - The image will be stretched to fill the entire frame of the
3476 * view without clipping. This may change the aspect ratio of the image,
3477 * distoring it. Only supported on iOS.
3478 */
3479 stretch: ImageResizeMode;
3480 /**
3481 * center - The image will be scaled down such that it is completely visible,
3482 * if bigger than the area of the view.
3483 * The image will not be scaled up.
3484 */
3485 center: ImageResizeMode;
3486
3487 /**
3488 * repeat - The image will be repeated to cover the frame of the View. The
3489 * image will keep it's size and aspect ratio.
3490 */
3491 repeat: ImageResizeMode;
3492}
3493
3494export interface ShadowStyleIOS {
3495 shadowColor?: ColorValue | undefined;
3496 shadowOffset?: { width: number; height: number } | undefined;
3497 shadowOpacity?: number | undefined;
3498 shadowRadius?: number | undefined;
3499}
3500
3501/**
3502 * Image style
3503 * @see https://reactnative.dev/docs/image#style
3504 * @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageStylePropTypes.js
3505 */
3506export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle {
3507 resizeMode?: ImageResizeMode | undefined;
3508 backfaceVisibility?: 'visible' | 'hidden' | undefined;
3509 borderBottomLeftRadius?: number | undefined;
3510 borderBottomRightRadius?: number | undefined;
3511 backgroundColor?: ColorValue | undefined;
3512 borderColor?: ColorValue | undefined;
3513 borderWidth?: number | undefined;
3514 borderRadius?: number | undefined;
3515 borderTopLeftRadius?: number | undefined;
3516 borderTopRightRadius?: number | undefined;
3517 overflow?: 'visible' | 'hidden' | undefined;
3518 overlayColor?: ColorValue | undefined;
3519 tintColor?: ColorValue | undefined;
3520 opacity?: number | undefined;
3521}
3522
3523/*
3524 * @see https://github.com/facebook/react-native/blob/master/Libraries/Image/ImageSourcePropType.js
3525 */
3526export interface ImageURISource {
3527 /**
3528 * `uri` is a string representing the resource identifier for the image, which
3529 * could be an http address, a local file path, or the name of a static image
3530 * resource (which should be wrapped in the `require('./path/to/image.png')`
3531 * function).
3532 */
3533 uri?: string | undefined;
3534 /**
3535 * `bundle` is the iOS asset bundle which the image is included in. This
3536 * will default to [NSBundle mainBundle] if not set.
3537 * @platform ios
3538 */
3539 bundle?: string | undefined;
3540 /**
3541 * `method` is the HTTP Method to use. Defaults to GET if not specified.
3542 */
3543 method?: string | undefined;
3544 /**
3545 * `headers` is an object representing the HTTP headers to send along with the
3546 * request for a remote image.
3547 */
3548 headers?: { [key: string]: string } | undefined;
3549 /**
3550 * `cache` determines how the requests handles potentially cached
3551 * responses.
3552 *
3553 * - `default`: Use the native platforms default strategy. `useProtocolCachePolicy` on iOS.
3554 *
3555 * - `reload`: The data for the URL will be loaded from the originating source.
3556 * No existing cache data should be used to satisfy a URL load request.
3557 *
3558 * - `force-cache`: The existing cached data will be used to satisfy the request,
3559 * regardless of its age or expiration date. If there is no existing data in the cache
3560 * corresponding the request, the data is loaded from the originating source.
3561 *
3562 * - `only-if-cached`: The existing cache data will be used to satisfy a request, regardless of
3563 * its age or expiration date. If there is no existing data in the cache corresponding
3564 * to a URL load request, no attempt is made to load the data from the originating source,
3565 * and the load is considered to have failed.
3566 *
3567 * @platform ios
3568 */
3569 cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached' | undefined;
3570 /**
3571 * `body` is the HTTP body to send with the request. This must be a valid
3572 * UTF-8 string, and will be sent exactly as specified, with no
3573 * additional encoding (e.g. URL-escaping or base64) applied.
3574 */
3575 body?: string | undefined;
3576 /**
3577 * `width` and `height` can be specified if known at build time, in which case
3578 * these will be used to set the default `<Image/>` component dimensions.
3579 */
3580 width?: number | undefined;
3581 height?: number | undefined;
3582 /**
3583 * `scale` is used to indicate the scale factor of the image. Defaults to 1.0 if
3584 * unspecified, meaning that one image pixel equates to one display point / DIP.
3585 */
3586 scale?: number | undefined;
3587}
3588
3589export type ImageRequireSource = number;
3590
3591/**
3592 * @see ImagePropsIOS.onProgress
3593 */
3594export interface ImageProgressEventDataIOS {
3595 loaded: number;
3596 total: number;
3597}
3598
3599export interface ImagePropsIOS {
3600 /**
3601 * blurRadius: the blur radius of the blur filter added to the image
3602 * @platform ios
3603 */
3604 blurRadius?: number | undefined;
3605
3606 /**
3607 * When the image is resized, the corners of the size specified by capInsets will stay a fixed size,
3608 * but the center content and borders of the image will be stretched.
3609 * This is useful for creating resizable rounded buttons, shadows, and other resizable assets.
3610 * More info on Apple documentation
3611 */
3612 capInsets?: Insets | undefined;
3613
3614 /**
3615 * Invoked on download progress with {nativeEvent: {loaded, total}}
3616 */
3617 onProgress?: ((event: NativeSyntheticEvent<ImageProgressEventDataIOS>) => void) | undefined;
3618
3619 /**
3620 * Invoked when a partial load of the image is complete. The definition of
3621 * what constitutes a "partial load" is loader specific though this is meant
3622 * for progressive JPEG loads.
3623 * @platform ios
3624 */
3625 onPartialLoad?: (() => void) | undefined;
3626}
3627
3628interface ImagePropsAndroid {
3629 /**
3630 * The mechanism that should be used to resize the image when the image's dimensions
3631 * differ from the image view's dimensions. Defaults to auto.
3632 *
3633 * 'auto': Use heuristics to pick between resize and scale.
3634 *
3635 * 'resize': A software operation which changes the encoded image in memory before it gets decoded.
3636 * This should be used instead of scale when the image is much larger than the view.
3637 *
3638 * 'scale': The image gets drawn downscaled or upscaled. Compared to resize, scale is faster (usually hardware accelerated)
3639 * and produces higher quality images. This should be used if the image is smaller than the view.
3640 * It should also be used if the image is slightly bigger than the view.
3641 */
3642 resizeMethod?: 'auto' | 'resize' | 'scale' | undefined;
3643
3644 /**
3645 * Duration of fade in animation in ms. Defaults to 300
3646 *
3647 * @platform android
3648 */
3649 fadeDuration?: number | undefined;
3650
3651 /**
3652 * Required if loading images via 'uri' from drawable folder on Android.
3653 * Explanation: https://medium.com/@adamjacobb/react-native-performance-images-adf5843e120
3654 */
3655 width?: number | undefined;
3656
3657 /**
3658 * Required if loading images via 'uri' from drawable folder on Android
3659 * Explanation: https://medium.com/@adamjacobb/react-native-performance-images-adf5843e120
3660 */
3661 height?: number | undefined;
3662}
3663
3664/**
3665 * @see https://reactnative.dev/docs/image#source
3666 */
3667export type ImageSourcePropType = ImageURISource | ImageURISource[] | ImageRequireSource;
3668
3669export interface ImageLoadEventData {
3670 source: {
3671 height: number;
3672 width: number;
3673 uri: string;
3674 };
3675}
3676
3677export interface ImageErrorEventData {
3678 error: any;
3679}
3680
3681/**
3682 * @see https://reactnative.dev/docs/image#resolveassetsource
3683 */
3684export interface ImageResolvedAssetSource {
3685 height: number;
3686 width: number;
3687 scale: number;
3688 uri: string;
3689}
3690
3691/**
3692 * @see https://reactnative.dev/docs/image
3693 */
3694export interface ImagePropsBase extends ImagePropsIOS, ImagePropsAndroid, AccessibilityProps {
3695 /**
3696 * onLayout function
3697 *
3698 * Invoked on mount and layout changes with
3699 *
3700 * {nativeEvent: { layout: {x, y, width, height} }}.
3701 */
3702 onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
3703
3704 /**
3705 * Invoked on load error with {nativeEvent: {error}}
3706 */
3707 onError?: ((error: NativeSyntheticEvent<ImageErrorEventData>) => void) | undefined;
3708
3709 /**
3710 * Invoked when load completes successfully
3711 * { source: { uri, height, width } }.
3712 */
3713 onLoad?: ((event: NativeSyntheticEvent<ImageLoadEventData>) => void) | undefined;
3714
3715 /**
3716 * Invoked when load either succeeds or fails
3717 */
3718 onLoadEnd?: (() => void) | undefined;
3719
3720 /**
3721 * Invoked on load start
3722 */
3723 onLoadStart?: (() => void) | undefined;
3724
3725 progressiveRenderingEnabled?: boolean | undefined;
3726
3727 borderRadius?: number | undefined;
3728
3729 borderTopLeftRadius?: number | undefined;
3730
3731 borderTopRightRadius?: number | undefined;
3732
3733 borderBottomLeftRadius?: number | undefined;
3734
3735 borderBottomRightRadius?: number | undefined;
3736
3737 /**
3738 * Determines how to resize the image when the frame doesn't match the raw
3739 * image dimensions.
3740 *
3741 * 'cover': Scale the image uniformly (maintain the image's aspect ratio)
3742 * so that both dimensions (width and height) of the image will be equal
3743 * to or larger than the corresponding dimension of the view (minus padding).
3744 *
3745 * 'contain': Scale the image uniformly (maintain the image's aspect ratio)
3746 * so that both dimensions (width and height) of the image will be equal to
3747 * or less than the corresponding dimension of the view (minus padding).
3748 *
3749 * 'stretch': Scale width and height independently, This may change the
3750 * aspect ratio of the src.
3751 *
3752 * 'repeat': Repeat the image to cover the frame of the view.
3753 * The image will keep it's size and aspect ratio. (iOS only)
3754 *
3755 * 'center': Scale the image down so that it is completely visible,
3756 * if bigger than the area of the view.
3757 * The image will not be scaled up.
3758 */
3759 resizeMode?: ImageResizeMode | undefined;
3760
3761 /**
3762 * The mechanism that should be used to resize the image when the image's dimensions
3763 * differ from the image view's dimensions. Defaults to `auto`.
3764 *
3765 * - `auto`: Use heuristics to pick between `resize` and `scale`.
3766 *
3767 * - `resize`: A software operation which changes the encoded image in memory before it
3768 * gets decoded. This should be used instead of `scale` when the image is much larger
3769 * than the view.
3770 *
3771 * - `scale`: The image gets drawn downscaled or upscaled. Compared to `resize`, `scale` is
3772 * faster (usually hardware accelerated) and produces higher quality images. This
3773 * should be used if the image is smaller than the view. It should also be used if the
3774 * image is slightly bigger than the view.
3775 *
3776 * More details about `resize` and `scale` can be found at http://frescolib.org/docs/resizing-rotating.html.
3777 *
3778 * @platform android
3779 */
3780 resizeMethod?: 'auto' | 'resize' | 'scale' | undefined;
3781
3782 /**
3783 * The image source (either a remote URL or a local file resource).
3784 *
3785 * This prop can also contain several remote URLs, specified together with their width and height and potentially with scale/other URI arguments.
3786 * The native side will then choose the best uri to display based on the measured size of the image container.
3787 * A cache property can be added to control how networked request interacts with the local cache.
3788 *
3789 * The currently supported formats are png, jpg, jpeg, bmp, gif, webp (Android only), psd (iOS only).
3790 */
3791 source: ImageSourcePropType;
3792
3793 /**
3794 * similarly to `source`, this property represents the resource used to render
3795 * the loading indicator for the image, displayed until image is ready to be
3796 * displayed, typically after when it got downloaded from network.
3797 */
3798 loadingIndicatorSource?: ImageURISource | undefined;
3799
3800 /**
3801 * A unique identifier for this element to be used in UI Automation testing scripts.
3802 */
3803 testID?: string | undefined;
3804
3805 /**
3806 * Used to reference react managed images from native code.
3807 */
3808 nativeID?: string | undefined;
3809
3810 /**
3811 * A static image to display while downloading the final image off the network.
3812 */
3813 defaultSource?: ImageURISource | number | undefined;
3814}
3815
3816export interface ImageProps extends ImagePropsBase {
3817 /**
3818 *
3819 * Style
3820 */
3821 style?: StyleProp<ImageStyle> | undefined;
3822}
3823
3824declare class ImageComponent extends React.Component<ImageProps> {}
3825declare const ImageBase: Constructor<NativeMethods> & typeof ImageComponent;
3826export class Image extends ImageBase {
3827 static getSize(uri: string, success: (width: number, height: number) => void, failure?: (error: any) => void): any;
3828 static getSizeWithHeaders(
3829 uri: string,
3830 headers: { [index: string]: string },
3831 success: (width: number, height: number) => void,
3832 failure?: (error: any) => void,
3833 ): any;
3834 static prefetch(url: string): Promise<boolean>;
3835 static prefetchWithMetadata(url: string, queryRootName: string, rootTag?: number): Promise<boolean>;
3836 static abortPrefetch?(requestId: number): void;
3837 static queryCache?(urls: string[]): Promise<{ [url: string]: 'memory' | 'disk' | 'disk/memory' }>;
3838
3839 /**
3840 * @see https://reactnative.dev/docs/image#resolveassetsource
3841 */
3842 static resolveAssetSource(source: ImageSourcePropType): ImageResolvedAssetSource;
3843}
3844
3845export interface ImageBackgroundProps extends ImagePropsBase {
3846 imageStyle?: StyleProp<ImageStyle> | undefined;
3847 style?: StyleProp<ViewStyle> | undefined;
3848 imageRef?(image: Image): void;
3849}
3850
3851declare class ImageBackgroundComponent extends React.Component<ImageBackgroundProps> {}
3852declare const ImageBackgroundBase: Constructor<NativeMethods> & typeof ImageBackgroundComponent;
3853export class ImageBackground extends ImageBackgroundBase {
3854 resizeMode: ImageResizeMode;
3855 getSize(uri: string, success: (width: number, height: number) => void, failure: (error: any) => void): any;
3856 prefetch(url: string): any;
3857 abortPrefetch?(requestId: number): void;
3858 queryCache?(urls: string[]): Promise<{ [url: string]: 'memory' | 'disk' | 'disk/memory' }>;
3859}
3860
3861export interface ViewToken {
3862 item: any;
3863 key: string;
3864 index: number | null;
3865 isViewable: boolean;
3866 section?: any;
3867}
3868
3869export interface ViewabilityConfig {
3870 /**
3871 * Minimum amount of time (in milliseconds) that an item must be physically viewable before the
3872 * viewability callback will be fired. A high number means that scrolling through content without
3873 * stopping will not mark the content as viewable.
3874 */
3875 minimumViewTime?: number | undefined;
3876
3877 /**
3878 * Percent of viewport that must be covered for a partially occluded item to count as
3879 * "viewable", 0-100. Fully visible items are always considered viewable. A value of 0 means
3880 * that a single pixel in the viewport makes the item viewable, and a value of 100 means that
3881 * an item must be either entirely visible or cover the entire viewport to count as viewable.
3882 */
3883 viewAreaCoveragePercentThreshold?: number | undefined;
3884
3885 /**
3886 * Similar to `viewAreaCoveragePercentThreshold`, but considers the percent of the item that is visible,
3887 * rather than the fraction of the viewable area it covers.
3888 */
3889 itemVisiblePercentThreshold?: number | undefined;
3890
3891 /**
3892 * Nothing is considered viewable until the user scrolls or `recordInteraction` is called after
3893 * render.
3894 */
3895 waitForInteraction?: boolean | undefined;
3896}
3897
3898export interface ViewabilityConfigCallbackPair {
3899 viewabilityConfig: ViewabilityConfig;
3900 onViewableItemsChanged: ((info: { viewableItems: Array<ViewToken>; changed: Array<ViewToken> }) => void) | null;
3901}
3902
3903export type ViewabilityConfigCallbackPairs = ViewabilityConfigCallbackPair[];
3904
3905/**
3906 * @see https://reactnative.dev/docs/flatlist#props
3907 */
3908
3909export interface ListRenderItemInfo<ItemT> {
3910 item: ItemT;
3911
3912 index: number;
3913
3914 separators: {
3915 highlight: () => void;
3916 unhighlight: () => void;
3917 updateProps: (select: 'leading' | 'trailing', newProps: any) => void;
3918 };
3919}
3920
3921export type ListRenderItem<ItemT> = (info: ListRenderItemInfo<ItemT>) => React.ReactElement | null;
3922
3923export interface FlatListProps<ItemT> extends VirtualizedListProps<ItemT> {
3924 /**
3925 * Rendered in between each item, but not at the top or bottom
3926 */
3927 ItemSeparatorComponent?: React.ComponentType<any> | null | undefined;
3928
3929 /**
3930 * Rendered when the list is empty.
3931 */
3932 ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
3933
3934 /**
3935 * Rendered at the very end of the list.
3936 */
3937 ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
3938
3939 /**
3940 * Styling for internal View for ListFooterComponent
3941 */
3942 ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined;
3943
3944 /**
3945 * Rendered at the very beginning of the list.
3946 */
3947 ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
3948
3949 /**
3950 * Styling for internal View for ListHeaderComponent
3951 */
3952 ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined;
3953
3954 /**
3955 * Optional custom style for multi-item rows generated when numColumns > 1
3956 */
3957 columnWrapperStyle?: StyleProp<ViewStyle> | undefined;
3958
3959 /**
3960 * Determines when the keyboard should stay visible after a tap.
3961 * - 'never' (the default), tapping outside of the focused text input when the keyboard is up dismisses the keyboard. When this happens, children won't receive the tap.
3962 * - 'always', the keyboard will not dismiss automatically, and the scroll view will not catch taps, but children of the scroll view can catch taps.
3963 * - 'handled', the keyboard will not dismiss automatically when the tap was handled by a children, (or captured by an ancestor).
3964 * - false, deprecated, use 'never' instead
3965 * - true, deprecated, use 'always' instead
3966 */
3967 keyboardShouldPersistTaps?: boolean | 'always' | 'never' | 'handled' | undefined;
3968
3969 /**
3970 * For simplicity, data is just a plain array. If you want to use something else,
3971 * like an immutable list, use the underlying VirtualizedList directly.
3972 */
3973 data: ReadonlyArray<ItemT> | null | undefined;
3974
3975 /**
3976 * A marker property for telling the list to re-render (since it implements PureComponent).
3977 * If any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the `data` prop,
3978 * stick it here and treat it immutably.
3979 */
3980 extraData?: any;
3981
3982 /**
3983 * `getItemLayout` is an optional optimization that lets us skip measurement of dynamic
3984 * content if you know the height of items a priori. getItemLayout is the most efficient,
3985 * and is easy to use if you have fixed height items, for example:
3986 * ```
3987 * getItemLayout={(data, index) => (
3988 * {length: ITEM_HEIGHT, offset: ITEM_HEIGHT * index, index}
3989 * )}
3990 * ```
3991 * Remember to include separator length (height or width) in your offset calculation if you specify
3992 * `ItemSeparatorComponent`.
3993 */
3994 getItemLayout?: ((
3995 data: Array<ItemT> | null | undefined,
3996 index: number,
3997 ) => { length: number; offset: number; index: number }) | undefined;
3998
3999 /**
4000 * If true, renders items next to each other horizontally instead of stacked vertically.
4001 */
4002 horizontal?: boolean | null | undefined;
4003
4004 /**
4005 * How many items to render in the initial batch
4006 */
4007 initialNumToRender?: number | undefined;
4008
4009 /**
4010 * Instead of starting at the top with the first item, start at initialScrollIndex
4011 */
4012 initialScrollIndex?: number | null | undefined;
4013
4014 /**
4015 * Used to extract a unique key for a given item at the specified index. Key is used for caching
4016 * and as the react key to track item re-ordering. The default extractor checks `item.key`, then
4017 * falls back to using the index, like React does.
4018 */
4019 keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
4020
4021 /**
4022 * Uses legacy MetroListView instead of default VirtualizedSectionList
4023 */
4024 legacyImplementation?: boolean | undefined;
4025
4026 /**
4027 * Multiple columns can only be rendered with `horizontal={false}` and will zig-zag like a `flexWrap` layout.
4028 * Items should all be the same height - masonry layouts are not supported.
4029 */
4030 numColumns?: number | undefined;
4031
4032 /**
4033 * Called once when the scroll position gets within onEndReachedThreshold of the rendered content.
4034 */
4035 onEndReached?: ((info: { distanceFromEnd: number }) => void) | null | undefined;
4036
4037 /**
4038 * How far from the end (in units of visible length of the list) the bottom edge of the
4039 * list must be from the end of the content to trigger the `onEndReached` callback.
4040 * Thus a value of 0.5 will trigger `onEndReached` when the end of the content is
4041 * within half the visible length of the list.
4042 */
4043 onEndReachedThreshold?: number | null | undefined;
4044
4045 /**
4046 * If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality.
4047 * Make sure to also set the refreshing prop correctly.
4048 */
4049 onRefresh?: (() => void) | null | undefined;
4050
4051 /**
4052 * Called when the viewability of rows changes, as defined by the `viewablePercentThreshold` prop.
4053 */
4054 onViewableItemsChanged?: ((info: { viewableItems: Array<ViewToken>; changed: Array<ViewToken> }) => void) | null | undefined;
4055
4056 /**
4057 * Set this true while waiting for new data from a refresh.
4058 */
4059 refreshing?: boolean | null | undefined;
4060
4061 /**
4062 * Takes an item from data and renders it into the list. Typical usage:
4063 * ```
4064 * _renderItem = ({item}) => (
4065 * <TouchableOpacity onPress={() => this._onPress(item)}>
4066 * <Text>{item.title}</Text>
4067 * <TouchableOpacity/>
4068 * );
4069 * ...
4070 * <FlatList data={[{title: 'Title Text', key: 'item1'}]} renderItem={this._renderItem} />
4071 * ```
4072 * Provides additional metadata like `index` if you need it.
4073 */
4074 renderItem: ListRenderItem<ItemT> | null | undefined;
4075
4076 /**
4077 * See `ViewabilityHelper` for flow type and further documentation.
4078 */
4079 viewabilityConfig?: any;
4080
4081 /**
4082 * Note: may have bugs (missing content) in some circumstances - use at your own risk.
4083 *
4084 * This may improve scroll performance for large lists.
4085 */
4086 removeClippedSubviews?: boolean | undefined;
4087
4088 /**
4089 * Fades out the edges of the the scroll content.
4090 *
4091 * If the value is greater than 0, the fading edges will be set accordingly
4092 * to the current scroll direction and position,
4093 * indicating if there is more content to show.
4094 *
4095 * The default value is 0.
4096 * @platform android
4097 */
4098 fadingEdgeLength?: number | undefined;
4099}
4100
4101export class FlatList<ItemT = any> extends React.Component<FlatListProps<ItemT>> {
4102 /**
4103 * Scrolls to the end of the content. May be janky without `getItemLayout` prop.
4104 */
4105 scrollToEnd: (params?: { animated?: boolean | null | undefined }) => void;
4106
4107 /**
4108 * Scrolls to the item at the specified index such that it is positioned in the viewable area
4109 * such that viewPosition 0 places it at the top, 1 at the bottom, and 0.5 centered in the middle.
4110 * Cannot scroll to locations outside the render window without specifying the getItemLayout prop.
4111 */
4112 scrollToIndex: (params: {
4113 animated?: boolean | null | undefined;
4114 index: number;
4115 viewOffset?: number | undefined;
4116 viewPosition?: number | undefined;
4117 }) => void;
4118
4119 /**
4120 * Requires linear scan through data - use `scrollToIndex` instead if possible.
4121 * May be janky without `getItemLayout` prop.
4122 */
4123 scrollToItem: (params: { animated?: boolean | null | undefined; item: ItemT; viewPosition?: number | undefined }) => void;
4124
4125 /**
4126 * Scroll to a specific content pixel offset, like a normal `ScrollView`.
4127 */
4128 scrollToOffset: (params: { animated?: boolean | null | undefined; offset: number }) => void;
4129
4130 /**
4131 * Tells the list an interaction has occurred, which should trigger viewability calculations,
4132 * e.g. if waitForInteractions is true and the user has not scrolled. This is typically called
4133 * by taps on items or by navigation actions.
4134 */
4135 recordInteraction: () => void;
4136
4137 /**
4138 * Displays the scroll indicators momentarily.
4139 */
4140 flashScrollIndicators: () => void;
4141
4142 /**
4143 * Provides a handle to the underlying scroll responder.
4144 */
4145 getScrollResponder: () => JSX.Element | null | undefined;
4146
4147 /**
4148 * Provides a reference to the underlying host component
4149 */
4150 getNativeScrollRef: () => React.ElementRef<typeof View> | React.ElementRef<typeof ScrollViewComponent> | null | undefined;
4151
4152 getScrollableNode: () => any;
4153
4154 // TODO: use `unknown` instead of `any` for Typescript >= 3.0
4155 setNativeProps: (props: { [key: string]: any }) => void;
4156}
4157
4158/**
4159 * @see https://reactnative.dev/docs/sectionlist
4160 */
4161
4162type DefaultSectionT = {
4163 [key: string]: any;
4164};
4165
4166export interface SectionBase<ItemT, SectionT = DefaultSectionT> {
4167 data: ReadonlyArray<ItemT>;
4168
4169 key?: string | undefined;
4170
4171 renderItem?: SectionListRenderItem<ItemT, SectionT> | undefined;
4172
4173 ItemSeparatorComponent?: React.ComponentType<any> | null | undefined;
4174
4175 keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
4176}
4177
4178export type SectionListData<ItemT, SectionT = DefaultSectionT> = SectionBase<ItemT, SectionT> & SectionT;
4179
4180/**
4181 * @see https://reactnative.dev/docs/sectionlist.html#props
4182 */
4183
4184export interface SectionListRenderItemInfo<ItemT, SectionT = DefaultSectionT> extends ListRenderItemInfo<ItemT> {
4185 section: SectionListData<ItemT, SectionT>;
4186}
4187
4188export type SectionListRenderItem<ItemT, SectionT = DefaultSectionT> = (
4189 info: SectionListRenderItemInfo<ItemT, SectionT>,
4190) => React.ReactElement | null;
4191
4192export interface SectionListProps<ItemT, SectionT = DefaultSectionT>
4193 extends VirtualizedListWithoutRenderItemProps<ItemT> {
4194 /**
4195 * Rendered in between adjacent Items within each section.
4196 */
4197 ItemSeparatorComponent?: React.ComponentType<any> | null | undefined;
4198
4199 /**
4200 * Rendered when the list is empty.
4201 */
4202 ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
4203
4204 /**
4205 * Rendered at the very end of the list.
4206 */
4207 ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
4208
4209 /**
4210 * Styling for internal View for ListFooterComponent
4211 */
4212 ListFooterComponentStyle?: StyleProp<ViewStyle> | undefined | null;
4213
4214 /**
4215 * Rendered at the very beginning of the list.
4216 */
4217 ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
4218
4219 /**
4220 * Styling for internal View for ListHeaderComponent
4221 */
4222 ListHeaderComponentStyle?: StyleProp<ViewStyle> | undefined | null;
4223
4224 /**
4225 * Rendered in between each section.
4226 */
4227 SectionSeparatorComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
4228
4229 /**
4230 * A marker property for telling the list to re-render (since it implements PureComponent).
4231 * If any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the `data` prop,
4232 * stick it here and treat it immutably.
4233 */
4234 extraData?: any;
4235
4236 /**
4237 * `getItemLayout` is an optional optimization that lets us skip measurement of dynamic
4238 * content if you know the height of items a priori. getItemLayout is the most efficient,
4239 * and is easy to use if you have fixed height items, for example:
4240 * ```
4241 * getItemLayout={(data, index) => (
4242 * {length: ITEM_HEIGHT, offset: ITEM_HEIGHT * index, index}
4243 * )}
4244 * ```
4245 */
4246 getItemLayout?: ((
4247 data: SectionListData<ItemT, SectionT>[] | null,
4248 index: number,
4249 ) => { length: number; offset: number; index: number }) | undefined;
4250
4251 /**
4252 * How many items to render in the initial batch
4253 */
4254 initialNumToRender?: number | undefined;
4255
4256 /**
4257 * Reverses the direction of scroll. Uses scale transforms of -1.
4258 */
4259 inverted?: boolean | null | undefined;
4260
4261 /**
4262 * Used to extract a unique key for a given item at the specified index. Key is used for caching
4263 * and as the react key to track item re-ordering. The default extractor checks `item.key`, then
4264 * falls back to using the index, like React does.
4265 */
4266 keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
4267
4268 /**
4269 * Called once when the scroll position gets within onEndReachedThreshold of the rendered content.
4270 */
4271 onEndReached?: ((info: { distanceFromEnd: number }) => void) | null | undefined;
4272
4273 /**
4274 * How far from the end (in units of visible length of the list) the bottom edge of the
4275 * list must be from the end of the content to trigger the `onEndReached` callback.
4276 * Thus a value of 0.5 will trigger `onEndReached` when the end of the content is
4277 * within half the visible length of the list.
4278 */
4279 onEndReachedThreshold?: number | null | undefined;
4280
4281 /**
4282 * If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality.
4283 * Make sure to also set the refreshing prop correctly.
4284 */
4285 onRefresh?: (() => void) | null | undefined;
4286
4287 /**
4288 * Used to handle failures when scrolling to an index that has not been measured yet.
4289 * Recommended action is to either compute your own offset and `scrollTo` it, or scroll as far
4290 * as possible and then try again after more items have been rendered.
4291 */
4292 onScrollToIndexFailed?: ((info: {
4293 index: number;
4294 highestMeasuredFrameIndex: number;
4295 averageItemLength: number;
4296 }) => void) | undefined;
4297
4298 /**
4299 * Set this true while waiting for new data from a refresh.
4300 */
4301 refreshing?: boolean | null | undefined;
4302
4303 /**
4304 * Default renderer for every item in every section. Can be over-ridden on a per-section basis.
4305 */
4306 renderItem?: SectionListRenderItem<ItemT, SectionT> | undefined;
4307
4308 /**
4309 * Rendered at the top of each section. Sticky headers are not yet supported.
4310 */
4311 renderSectionHeader?: ((info: { section: SectionListData<ItemT, SectionT> }) => React.ReactElement | null) | undefined;
4312
4313 /**
4314 * Rendered at the bottom of each section.
4315 */
4316 renderSectionFooter?: ((info: { section: SectionListData<ItemT, SectionT> }) => React.ReactElement | null) | undefined;
4317
4318 /**
4319 * An array of objects with data for each section.
4320 */
4321 sections: ReadonlyArray<SectionListData<ItemT, SectionT>>;
4322
4323 /**
4324 * Render a custom scroll component, e.g. with a differently styled `RefreshControl`.
4325 */
4326 renderScrollComponent?: ((props: ScrollViewProps) => React.ReactElement<ScrollViewProps>) | undefined;
4327
4328 /**
4329 * Note: may have bugs (missing content) in some circumstances - use at your own risk.
4330 *
4331 * This may improve scroll performance for large lists.
4332 */
4333 removeClippedSubviews?: boolean | undefined;
4334
4335 /**
4336 * Makes section headers stick to the top of the screen until the next one pushes it off.
4337 * Only enabled by default on iOS because that is the platform standard there.
4338 */
4339 stickySectionHeadersEnabled?: boolean | undefined;
4340
4341 /**
4342 * Uses legacy MetroListView instead of default VirtualizedSectionList
4343 */
4344 legacyImplementation?: boolean | undefined;
4345}
4346
4347export interface SectionListScrollParams {
4348 animated?: boolean | undefined;
4349 itemIndex: number;
4350 sectionIndex: number;
4351 viewOffset?: number | undefined;
4352 viewPosition?: number | undefined;
4353}
4354
4355export class SectionList<ItemT = any, SectionT = DefaultSectionT> extends React.Component<
4356 SectionListProps<ItemT, SectionT>
4357> {
4358 /**
4359 * Scrolls to the item at the specified sectionIndex and itemIndex (within the section)
4360 * positioned in the viewable area such that viewPosition 0 places it at the top
4361 * (and may be covered by a sticky header), 1 at the bottom, and 0.5 centered in the middle.
4362 */
4363 scrollToLocation(params: SectionListScrollParams): void;
4364
4365 /**
4366 * Tells the list an interaction has occurred, which should trigger viewability calculations, e.g.
4367 * if `waitForInteractions` is true and the user has not scrolled. This is typically called by
4368 * taps on items or by navigation actions.
4369 */
4370 recordInteraction(): void;
4371
4372 /**
4373 * Displays the scroll indicators momentarily.
4374 *
4375 * @platform ios
4376 */
4377 flashScrollIndicators(): void;
4378
4379 /**
4380 * Provides a handle to the underlying scroll responder.
4381 */
4382 getScrollResponder(): ScrollView | undefined;
4383
4384 /**
4385 * Provides a handle to the underlying scroll node.
4386 */
4387 getScrollableNode(): NodeHandle | undefined;
4388}
4389
4390/* This definition is deprecated because it extends the wrong base type */
4391export interface SectionListStatic<ItemT, SectionT = DefaultSectionT>
4392 extends React.ComponentClass<SectionListProps<ItemT, SectionT>> {
4393 /**
4394 * Scrolls to the item at the specified sectionIndex and itemIndex (within the section)
4395 * positioned in the viewable area such that viewPosition 0 places it at the top
4396 * (and may be covered by a sticky header), 1 at the bottom, and 0.5 centered in the middle.
4397 */
4398 scrollToLocation?(params: SectionListScrollParams): void;
4399}
4400
4401/**
4402 * @see https://reactnative.dev/docs/virtualizedlist
4403 */
4404
4405export class VirtualizedList<ItemT> extends React.Component<VirtualizedListProps<ItemT>> {
4406 scrollToEnd: (params?: { animated?: boolean | undefined }) => void;
4407 scrollToIndex: (params: { animated?: boolean | undefined; index: number; viewOffset?: number | undefined; viewPosition?: number | undefined }) => void;
4408 scrollToItem: (params: { animated?: boolean | undefined; item: ItemT; viewPosition?: number | undefined }) => void;
4409
4410 /**
4411 * Scroll to a specific content pixel offset in the list.
4412 * Param `offset` expects the offset to scroll to. In case of horizontal is true, the
4413 * offset is the x-value, in any other case the offset is the y-value.
4414 * Param `animated` (true by default) defines whether the list should do an animation while scrolling.
4415 */
4416 scrollToOffset: (params: { animated?: boolean | undefined; offset: number }) => void;
4417
4418 recordInteraction: () => void;
4419}
4420
4421/**
4422 * @see https://reactnative.dev/docs/virtualizedlist#props
4423 */
4424
4425export interface VirtualizedListProps<ItemT> extends VirtualizedListWithoutRenderItemProps<ItemT> {
4426 renderItem: ListRenderItem<ItemT> | null | undefined;
4427}
4428
4429export interface VirtualizedListWithoutRenderItemProps<ItemT> extends ScrollViewProps {
4430 /**
4431 * Rendered when the list is empty. Can be a React Component Class, a render function, or
4432 * a rendered element.
4433 */
4434 ListEmptyComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
4435
4436 /**
4437 * Rendered at the bottom of all the items. Can be a React Component Class, a render function, or
4438 * a rendered element.
4439 */
4440 ListFooterComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
4441
4442 /**
4443 * Rendered at the top of all the items. Can be a React Component Class, a render function, or
4444 * a rendered element.
4445 */
4446 ListHeaderComponent?: React.ComponentType<any> | React.ReactElement | null | undefined;
4447
4448 /**
4449 * The default accessor functions assume this is an Array<{key: string}> but you can override
4450 * getItem, getItemCount, and keyExtractor to handle any type of index-based data.
4451 */
4452 data?: any;
4453
4454 /**
4455 * `debug` will turn on extra logging and visual overlays to aid with debugging both usage and
4456 * implementation, but with a significant perf hit.
4457 */
4458 debug?: boolean | undefined;
4459
4460 /**
4461 * DEPRECATED: Virtualization provides significant performance and memory optimizations, but fully
4462 * unmounts react instances that are outside of the render window. You should only need to disable
4463 * this for debugging purposes.
4464 */
4465 disableVirtualization?: boolean | undefined;
4466
4467 /**
4468 * A marker property for telling the list to re-render (since it implements `PureComponent`). If
4469 * any of your `renderItem`, Header, Footer, etc. functions depend on anything outside of the
4470 * `data` prop, stick it here and treat it immutably.
4471 */
4472 extraData?: any;
4473
4474 /**
4475 * A generic accessor for extracting an item from any sort of data blob.
4476 */
4477 getItem?: ((data: any, index: number) => ItemT) | undefined;
4478
4479 /**
4480 * Determines how many items are in the data blob.
4481 */
4482 getItemCount?: ((data: any) => number) | undefined;
4483
4484 getItemLayout?: ((
4485 data: any,
4486 index: number,
4487 ) => {
4488 length: number;
4489 offset: number;
4490 index: number;
4491 }) | undefined;
4492
4493 horizontal?: boolean | null | undefined;
4494
4495 /**
4496 * How many items to render in the initial batch. This should be enough to fill the screen but not
4497 * much more. Note these items will never be unmounted as part of the windowed rendering in order
4498 * to improve perceived performance of scroll-to-top actions.
4499 */
4500 initialNumToRender?: number | undefined;
4501
4502 /**
4503 * Instead of starting at the top with the first item, start at `initialScrollIndex`. This
4504 * disables the "scroll to top" optimization that keeps the first `initialNumToRender` items
4505 * always rendered and immediately renders the items starting at this initial index. Requires
4506 * `getItemLayout` to be implemented.
4507 */
4508 initialScrollIndex?: number | null | undefined;
4509
4510 /**
4511 * Reverses the direction of scroll. Uses scale transforms of -1.
4512 */
4513 inverted?: boolean | null | undefined;
4514
4515 keyExtractor?: ((item: ItemT, index: number) => string) | undefined;
4516
4517 listKey?: string | undefined;
4518
4519 /**
4520 * The maximum number of items to render in each incremental render batch. The more rendered at
4521 * once, the better the fill rate, but responsiveness my suffer because rendering content may
4522 * interfere with responding to button taps or other interactions.
4523 */
4524 maxToRenderPerBatch?: number | undefined;
4525
4526 onEndReached?: ((info: { distanceFromEnd: number }) => void) | null | undefined;
4527
4528 onEndReachedThreshold?: number | null | undefined;
4529
4530 onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
4531
4532 /**
4533 * If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make
4534 * sure to also set the `refreshing` prop correctly.
4535 */
4536 onRefresh?: (() => void) | null | undefined;
4537
4538 /**
4539 * Used to handle failures when scrolling to an index that has not been measured yet.
4540 * Recommended action is to either compute your own offset and `scrollTo` it, or scroll as far
4541 * as possible and then try again after more items have been rendered.
4542 */
4543 onScrollToIndexFailed?: ((info: {
4544 index: number;
4545 highestMeasuredFrameIndex: number;
4546 averageItemLength: number;
4547 }) => void) | undefined;
4548
4549 /**
4550 * Called when the viewability of rows changes, as defined by the
4551 * `viewabilityConfig` prop.
4552 */
4553 onViewableItemsChanged?: ((info: { viewableItems: Array<ViewToken>; changed: Array<ViewToken> }) => void) | null | undefined;
4554
4555 /**
4556 * Set this when offset is needed for the loading indicator to show correctly.
4557 * @platform android
4558 */
4559 progressViewOffset?: number | undefined;
4560
4561 /**
4562 * Set this true while waiting for new data from a refresh.
4563 */
4564 refreshing?: boolean | null | undefined;
4565
4566 /**
4567 * Note: may have bugs (missing content) in some circumstances - use at your own risk.
4568 *
4569 * This may improve scroll performance for large lists.
4570 */
4571 removeClippedSubviews?: boolean | undefined;
4572
4573 /**
4574 * Render a custom scroll component, e.g. with a differently styled `RefreshControl`.
4575 */
4576 renderScrollComponent?: ((props: ScrollViewProps) => React.ReactElement<ScrollViewProps>) | undefined;
4577
4578 /**
4579 * Amount of time between low-pri item render batches, e.g. for rendering items quite a ways off
4580 * screen. Similar fill rate/responsiveness tradeoff as `maxToRenderPerBatch`.
4581 */
4582 updateCellsBatchingPeriod?: number | undefined;
4583
4584 viewabilityConfig?: ViewabilityConfig | undefined;
4585
4586 viewabilityConfigCallbackPairs?: ViewabilityConfigCallbackPairs | undefined;
4587
4588 /**
4589 * Determines the maximum number of items rendered outside of the visible area, in units of
4590 * visible lengths. So if your list fills the screen, then `windowSize={21}` (the default) will
4591 * render the visible screen area plus up to 10 screens above and 10 below the viewport. Reducing
4592 * this number will reduce memory consumption and may improve performance, but will increase the
4593 * chance that fast scrolling may reveal momentary blank areas of unrendered content.
4594 */
4595 windowSize?: number | undefined;
4596
4597 CellRendererComponent?: React.ComponentType<any> | undefined;
4598}
4599
4600/**
4601 * @see https://reactnative.dev/docs/listview#props
4602 */
4603export interface ListViewProps extends ScrollViewProps {
4604 /**
4605 * An instance of [ListView.DataSource](docs/listviewdatasource.html) to use
4606 */
4607 dataSource: ListViewDataSource;
4608
4609 /**
4610 * Flag indicating whether empty section headers should be rendered.
4611 * In the future release empty section headers will be rendered by
4612 * default, and the flag will be deprecated. If empty sections are not
4613 * desired to be rendered their indices should be excluded from
4614 * sectionID object.
4615 */
4616 enableEmptySections?: boolean | undefined;
4617
4618 /**
4619 * How many rows to render on initial component mount. Use this to make
4620 * it so that the first screen worth of data apears at one time instead of
4621 * over the course of multiple frames.
4622 */
4623 initialListSize?: number | undefined;
4624
4625 /**
4626 * (visibleRows, changedRows) => void
4627 *
4628 * Called when the set of visible rows changes. `visibleRows` maps
4629 * { sectionID: { rowID: true }} for all the visible rows, and
4630 * `changedRows` maps { sectionID: { rowID: true | false }} for the rows
4631 * that have changed their visibility, with true indicating visible, and
4632 * false indicating the view has moved out of view.
4633 */
4634 onChangeVisibleRows?: ((
4635 visibleRows: Array<{ [sectionId: string]: { [rowID: string]: boolean } }>,
4636 changedRows: Array<{ [sectionId: string]: { [rowID: string]: boolean } }>,
4637 ) => void) | undefined;
4638
4639 /**
4640 * Called when all rows have been rendered and the list has been scrolled
4641 * to within onEndReachedThreshold of the bottom. The native scroll
4642 * event is provided.
4643 */
4644 onEndReached?: (() => void) | undefined;
4645
4646 /**
4647 * Threshold in pixels for onEndReached.
4648 */
4649 onEndReachedThreshold?: number | undefined;
4650
4651 /**
4652 * Number of rows to render per event loop.
4653 */
4654 pageSize?: number | undefined;
4655
4656 /**
4657 * A performance optimization for improving scroll perf of
4658 * large lists, used in conjunction with overflow: 'hidden' on the row
4659 * containers. Use at your own risk.
4660 */
4661 removeClippedSubviews?: boolean | undefined;
4662
4663 /**
4664 * () => renderable
4665 *
4666 * The header and footer are always rendered (if these props are provided)
4667 * on every render pass. If they are expensive to re-render, wrap them
4668 * in StaticContainer or other mechanism as appropriate. Footer is always
4669 * at the bottom of the list, and header at the top, on every render pass.
4670 */
4671 renderFooter?: (() => React.ReactElement) | undefined;
4672
4673 /**
4674 * () => renderable
4675 *
4676 * The header and footer are always rendered (if these props are provided)
4677 * on every render pass. If they are expensive to re-render, wrap them
4678 * in StaticContainer or other mechanism as appropriate. Footer is always
4679 * at the bottom of the list, and header at the top, on every render pass.
4680 */
4681 renderHeader?: (() => React.ReactElement) | undefined;
4682
4683 /**
4684 * (rowData, sectionID, rowID) => renderable
4685 * Takes a data entry from the data source and its ids and should return
4686 * a renderable component to be rendered as the row. By default the data
4687 * is exactly what was put into the data source, but it's also possible to
4688 * provide custom extractors.
4689 */
4690 renderRow: (
4691 rowData: any,
4692 sectionID: string | number,
4693 rowID: string | number,
4694 highlightRow?: boolean,
4695 ) => React.ReactElement;
4696
4697 /**
4698 * A function that returns the scrollable component in which the list rows are rendered.
4699 * Defaults to returning a ScrollView with the given props.
4700 */
4701 renderScrollComponent?: ((props: ScrollViewProps) => React.ReactElement<ScrollViewProps>) | undefined;
4702
4703 /**
4704 * (sectionData, sectionID) => renderable
4705 *
4706 * If provided, a sticky header is rendered for this section. The sticky
4707 * behavior means that it will scroll with the content at the top of the
4708 * section until it reaches the top of the screen, at which point it will
4709 * stick to the top until it is pushed off the screen by the next section
4710 * header.
4711 */
4712 renderSectionHeader?: ((sectionData: any, sectionId: string | number) => React.ReactElement) | undefined;
4713
4714 /**
4715 * (sectionID, rowID, adjacentRowHighlighted) => renderable
4716 * If provided, a renderable component to be rendered as the separator below each row
4717 * but not the last row if there is a section header below.
4718 * Take a sectionID and rowID of the row above and whether its adjacent row is highlighted.
4719 */
4720 renderSeparator?: ((
4721 sectionID: string | number,
4722 rowID: string | number,
4723 adjacentRowHighlighted?: boolean,
4724 ) => React.ReactElement) | undefined;
4725
4726 /**
4727 * How early to start rendering rows before they come on screen, in
4728 * pixels.
4729 */
4730 scrollRenderAheadDistance?: number | undefined;
4731
4732 /**
4733 * An array of child indices determining which children get docked to the
4734 * top of the screen when scrolling. For example, passing
4735 * `stickyHeaderIndices={[0]}` will cause the first child to be fixed to the
4736 * top of the scroll view. This property is not supported in conjunction
4737 * with `horizontal={true}`.
4738 * @platform ios
4739 */
4740 stickyHeaderIndices?: number[] | undefined;
4741
4742 /**
4743 * Makes the sections headers sticky. The sticky behavior means that it will scroll with the
4744 * content at the top of the section until it reaches the top of the screen, at which point it
4745 * will stick to the top until it is pushed off the screen by the next section header. This
4746 * property is not supported in conjunction with `horizontal={true}`. Only enabled by default
4747 * on iOS because of typical platform standards.
4748 */
4749 stickySectionHeadersEnabled?: boolean | undefined;
4750}
4751
4752interface TimerMixin {
4753 setTimeout: typeof setTimeout;
4754 clearTimeout: typeof clearTimeout;
4755 setInterval: typeof setInterval;
4756 clearInterval: typeof clearInterval;
4757 setImmediate: typeof setImmediate;
4758 clearImmediate: typeof clearImmediate;
4759 requestAnimationFrame: typeof requestAnimationFrame;
4760 cancelAnimationFrame: typeof cancelAnimationFrame;
4761}
4762
4763declare class ListViewComponent extends React.Component<ListViewProps> {}
4764declare const ListViewBase: Constructor<ScrollResponderMixin> & Constructor<TimerMixin> & typeof ListViewComponent;
4765/**
4766 * @deprecated See Flatlist or SectionList
4767 * or use `deprecated-react-native-listview`
4768 * @see https://fb.me/nolistview
4769 */
4770export class ListView extends ListViewBase {
4771 static DataSource: ListViewDataSource;
4772
4773 /**
4774 * Exports some data, e.g. for perf investigations or analytics.
4775 */
4776 getMetrics: () => {
4777 contentLength: number;
4778 totalRows: number;
4779 renderedRows: number;
4780 visibleRows: number;
4781 };
4782
4783 /**
4784 * Provides a handle to the underlying scroll responder.
4785 */
4786 getScrollResponder: () => any;
4787
4788 /**
4789 * Scrolls to a given x, y offset, either immediately or with a smooth animation.
4790 *
4791 * See `ScrollView#scrollTo`.
4792 */
4793 scrollTo: (y?: number | { x?: number | undefined; y?: number | undefined; animated?: boolean | undefined }, x?: number, animated?: boolean) => void;
4794}
4795
4796interface MaskedViewIOSProps extends ViewProps {
4797 maskElement: React.ReactElement;
4798}
4799
4800/**
4801 * @see https://reactnative.dev/docs/maskedviewios
4802 */
4803declare class MaskedViewComponent extends React.Component<MaskedViewIOSProps> {}
4804declare const MaskedViewBase: Constructor<NativeMethods> & typeof MaskedViewComponent;
4805/**
4806 * MaskedViewIOS has been extracted from react-native core and will be removed in a future release.
4807 * It can now be installed and imported from `@react-native-community/masked-view` instead of 'react-native'.
4808 * @see https://github.com/react-native-community/react-native-masked-view
4809 * @deprecated
4810 */
4811export class MaskedViewIOS extends MaskedViewBase {}
4812
4813export interface ModalBaseProps {
4814 /**
4815 * @deprecated Use animationType instead
4816 */
4817 animated?: boolean | undefined;
4818 /**
4819 * The `animationType` prop controls how the modal animates.
4820 *
4821 * - `slide` slides in from the bottom
4822 * - `fade` fades into view
4823 * - `none` appears without an animation
4824 */
4825 animationType?: 'none' | 'slide' | 'fade' | undefined;
4826 /**
4827 * The `transparent` prop determines whether your modal will fill the entire view.
4828 * Setting this to `true` will render the modal over a transparent background.
4829 */
4830 transparent?: boolean | undefined;
4831 /**
4832 * The `visible` prop determines whether your modal is visible.
4833 */
4834 visible?: boolean | undefined;
4835 /**
4836 * The `onRequestClose` prop allows passing a function that will be called once the modal has been dismissed.
4837 * _On the Android platform, this is a required function._
4838 */
4839 onRequestClose?: (() => void) | undefined;
4840 /**
4841 * The `onShow` prop allows passing a function that will be called once the modal has been shown.
4842 */
4843 onShow?: ((event: NativeSyntheticEvent<any>) => void) | undefined;
4844}
4845
4846export interface ModalPropsIOS {
4847 /**
4848 * The `presentationStyle` determines the style of modal to show
4849 */
4850 presentationStyle?: 'fullScreen' | 'pageSheet' | 'formSheet' | 'overFullScreen' | undefined;
4851
4852 /**
4853 * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations.
4854 * On iOS, the modal is still restricted by what's specified in your app's Info.plist's UISupportedInterfaceOrientations field.
4855 */
4856 supportedOrientations?: Array<
4857 'portrait' | 'portrait-upside-down' | 'landscape' | 'landscape-left' | 'landscape-right'
4858 > | undefined;
4859
4860 /**
4861 * The `onDismiss` prop allows passing a function that will be called once the modal has been dismissed.
4862 */
4863 onDismiss?: (() => void) | undefined;
4864
4865 /**
4866 * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed.
4867 * The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation.
4868 */
4869 onOrientationChange?: ((event: NativeSyntheticEvent<any>) => void) | undefined;
4870}
4871
4872export interface ModalPropsAndroid {
4873 /**
4874 * Controls whether to force hardware acceleration for the underlying window.
4875 */
4876 hardwareAccelerated?: boolean | undefined;
4877
4878 /**
4879 * Determines whether your modal should go under the system statusbar.
4880 */
4881 statusBarTranslucent?: boolean | undefined;
4882}
4883
4884export type ModalProps = ModalBaseProps & ModalPropsIOS & ModalPropsAndroid & ViewProps;
4885
4886export class Modal extends React.Component<ModalProps> {}
4887
4888/**
4889 * @see https://github.com/facebook/react-native/blob/0.34-stable\Libraries\Components\Touchable\Touchable.js
4890 */
4891interface TouchableMixin {
4892 /**
4893 * Invoked when the item should be highlighted. Mixers should implement this
4894 * to visually distinguish the `VisualRect` so that the user knows that
4895 * releasing a touch will result in a "selection" (analog to click).
4896 */
4897 touchableHandleActivePressIn(e: GestureResponderEvent): void;
4898
4899 /**
4900 * Invoked when the item is "active" (in that it is still eligible to become
4901 * a "select") but the touch has left the `PressRect`. Usually the mixer will
4902 * want to unhighlight the `VisualRect`. If the user (while pressing) moves
4903 * back into the `PressRect` `touchableHandleActivePressIn` will be invoked
4904 * again and the mixer should probably highlight the `VisualRect` again. This
4905 * event will not fire on an `touchEnd/mouseUp` event, only move events while
4906 * the user is depressing the mouse/touch.
4907 */
4908 touchableHandleActivePressOut(e: GestureResponderEvent): void;
4909
4910 /**
4911 * Invoked when the item is "selected" - meaning the interaction ended by
4912 * letting up while the item was either in the state
4913 * `RESPONDER_ACTIVE_PRESS_IN` or `RESPONDER_INACTIVE_PRESS_IN`.
4914 */
4915 touchableHandlePress(e: GestureResponderEvent): void;
4916
4917 /**
4918 * Invoked when the item is long pressed - meaning the interaction ended by
4919 * letting up while the item was in `RESPONDER_ACTIVE_LONG_PRESS_IN`. If
4920 * `touchableHandleLongPress` is *not* provided, `touchableHandlePress` will
4921 * be called as it normally is. If `touchableHandleLongPress` is provided, by
4922 * default any `touchableHandlePress` callback will not be invoked. To
4923 * override this default behavior, override `touchableLongPressCancelsPress`
4924 * to return false. As a result, `touchableHandlePress` will be called when
4925 * lifting up, even if `touchableHandleLongPress` has also been called.
4926 */
4927 touchableHandleLongPress(e: GestureResponderEvent): void;
4928
4929 /**
4930 * Returns the amount to extend the `HitRect` into the `PressRect`. Positive
4931 * numbers mean the size expands outwards.
4932 */
4933 touchableGetPressRectOffset(): Insets;
4934
4935 /**
4936 * Returns the number of millis to wait before triggering a highlight.
4937 */
4938 touchableGetHighlightDelayMS(): number;
4939
4940 // These methods are undocumented but still being used by TouchableMixin internals
4941 touchableGetLongPressDelayMS(): number;
4942 touchableGetPressOutDelayMS(): number;
4943 touchableGetHitSlop(): Insets;
4944}
4945
4946export interface TouchableWithoutFeedbackPropsIOS {}
4947
4948export interface TouchableWithoutFeedbackPropsAndroid {
4949 /**
4950 * If true, doesn't play a system sound on touch.
4951 *
4952 * @platform android
4953 */
4954 touchSoundDisabled?: boolean | null | undefined;
4955}
4956
4957/**
4958 * @see https://reactnative.dev/docs/touchablewithoutfeedback#props
4959 */
4960export interface TouchableWithoutFeedbackProps
4961 extends TouchableWithoutFeedbackPropsIOS,
4962 TouchableWithoutFeedbackPropsAndroid,
4963 AccessibilityProps {
4964 children?: React.ReactNode;
4965
4966 /**
4967 * Delay in ms, from onPressIn, before onLongPress is called.
4968 */
4969 delayLongPress?: number | undefined;
4970
4971 /**
4972 * Delay in ms, from the start of the touch, before onPressIn is called.
4973 */
4974 delayPressIn?: number | undefined;
4975
4976 /**
4977 * Delay in ms, from the release of the touch, before onPressOut is called.
4978 */
4979 delayPressOut?: number | undefined;
4980
4981 /**
4982 * If true, disable all interactions for this component.
4983 */
4984 disabled?: boolean | null | undefined;
4985
4986 /**
4987 * This defines how far your touch can start away from the button.
4988 * This is added to pressRetentionOffset when moving off of the button.
4989 * NOTE The touch area never extends past the parent view bounds and
4990 * the Z-index of sibling views always takes precedence if a touch hits
4991 * two overlapping views.
4992 */
4993 hitSlop?: Insets | undefined;
4994
4995 /**
4996 * When `accessible` is true (which is the default) this may be called when
4997 * the OS-specific concept of "blur" occurs, meaning the element lost focus.
4998 * Some platforms may not have the concept of blur.
4999 */
5000 onBlur?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
5001
5002 /**
5003 * When `accessible` is true (which is the default) this may be called when
5004 * the OS-specific concept of "focus" occurs. Some platforms may not have
5005 * the concept of focus.
5006 */
5007 onFocus?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined;
5008
5009 /**
5010 * Invoked on mount and layout changes with
5011 * {nativeEvent: {layout: {x, y, width, height}}}
5012 */
5013 onLayout?: ((event: LayoutChangeEvent) => void) | undefined;
5014
5015 onLongPress?: ((event: GestureResponderEvent) => void) | undefined;
5016
5017 /**
5018 * Called when the touch is released,
5019 * but not if cancelled (e.g. by a scroll that steals the responder lock).
5020 */
5021 onPress?: ((event: GestureResponderEvent) => void) | undefined;
5022
5023 onPressIn?: ((event: GestureResponderEvent) => void) | undefined;
5024
5025 onPressOut?: ((event: GestureResponderEvent) => void) | undefined;
5026
5027 /**
5028 * //FIXME: not in doc but available in examples
5029 */
5030 style?: StyleProp<ViewStyle> | undefined;
5031
5032 /**
5033 * When the scroll view is disabled, this defines how far your
5034 * touch may move off of the button, before deactivating the button.
5035 * Once deactivated, try moving it back and you'll see that the button
5036 * is once again reactivated! Move it back and forth several times
5037 * while the scroll view is disabled. Ensure you pass in a constant
5038 * to reduce memory allocations.
5039 */
5040 pressRetentionOffset?: Insets | undefined;
5041
5042 /**
5043 * Used to locate this view in end-to-end tests.
5044 */
5045 testID?: string | undefined;
5046}
5047
5048/**
5049 * Do not use unless you have a very good reason.
5050 * All the elements that respond to press should have a visual feedback when touched.
5051 * This is one of the primary reason a "web" app doesn't feel "native".
5052 *
5053 * @see https://reactnative.dev/docs/touchablewithoutfeedback
5054 */
5055declare class TouchableWithoutFeedbackComponent extends React.Component<TouchableWithoutFeedbackProps> {}
5056declare const TouchableWithoutFeedbackBase: Constructor<TimerMixin> &
5057 Constructor<TouchableMixin> &
5058 typeof TouchableWithoutFeedbackComponent;
5059export class TouchableWithoutFeedback extends TouchableWithoutFeedbackBase {}
5060
5061/**
5062 * @see https://reactnative.dev/docs/touchablehighlight#props
5063 */
5064export interface TouchableHighlightProps extends TouchableWithoutFeedbackProps {
5065 /**
5066 * Determines what the opacity of the wrapped view should be when touch is active.
5067 */
5068 activeOpacity?: number | undefined;
5069
5070 /**
5071 *
5072 * Called immediately after the underlay is hidden
5073 */
5074 onHideUnderlay?: (() => void) | undefined;
5075
5076 /**
5077 * Called immediately after the underlay is shown
5078 */
5079 onShowUnderlay?: (() => void) | undefined;
5080
5081 /**
5082 * @see https://reactnative.dev/docs/view#style
5083 */
5084 style?: StyleProp<ViewStyle> | undefined;
5085
5086 /**
5087 * The color of the underlay that will show through when the touch is active.
5088 */
5089 underlayColor?: ColorValue | undefined;
5090}
5091
5092/**
5093 * A wrapper for making views respond properly to touches.
5094 * On press down, the opacity of the wrapped view is decreased,
5095 * which allows the underlay color to show through, darkening or tinting the view.
5096 * The underlay comes from adding a view to the view hierarchy,
5097 * which can sometimes cause unwanted visual artifacts if not used correctly,
5098 * for example if the backgroundColor of the wrapped view isn't explicitly set to an opaque color.
5099 *
5100 * NOTE: TouchableHighlight supports only one child
5101 * If you wish to have several child components, wrap them in a View.
5102 *
5103 * @see https://reactnative.dev/docs/touchablehighlight
5104 */
5105declare class TouchableHighlightComponent extends React.Component<TouchableHighlightProps> {}
5106declare const TouchableHighlightBase: Constructor<NativeMethods> &
5107 Constructor<TimerMixin> &
5108 Constructor<TouchableMixin> &
5109 typeof TouchableHighlightComponent;
5110export class TouchableHighlight extends TouchableHighlightBase {}
5111
5112/**
5113 * @see https://reactnative.dev/docs/touchableopacity#props
5114 */
5115export interface TouchableOpacityProps extends TouchableWithoutFeedbackProps, TVProps {
5116 /**
5117 * Determines what the opacity of the wrapped view should be when touch is active.
5118 * Defaults to 0.2
5119 */
5120 activeOpacity?: number | undefined;
5121
5122 /**
5123 * *(Apple TV only)* Object with properties to control Apple TV parallax effects.
5124 *
5125 * enabled: If true, parallax effects are enabled. Defaults to true.
5126 * shiftDistanceX: Defaults to 2.0.
5127 * shiftDistanceY: Defaults to 2.0.
5128 * tiltAngle: Defaults to 0.05.
5129 * magnification: Defaults to 1.0.
5130 * pressMagnification: Defaults to 1.0.
5131 * pressDuration: Defaults to 0.3.
5132 * pressDelay: Defaults to 0.0.
5133 *
5134 * @platform android
5135 */
5136 tvParallaxProperties?: TVParallaxProperties | undefined;
5137}
5138
5139/**
5140 * A wrapper for making views respond properly to touches.
5141 * On press down, the opacity of the wrapped view is decreased, dimming it.
5142 * This is done without actually changing the view hierarchy,
5143 * and in general is easy to add to an app without weird side-effects.
5144 *
5145 * @see https://reactnative.dev/docs/touchableopacity
5146 */
5147declare class TouchableOpacityComponent extends React.Component<TouchableOpacityProps> {}
5148declare const TouchableOpacityBase: Constructor<TimerMixin> &
5149 Constructor<TouchableMixin> &
5150 Constructor<NativeMethods> &
5151 typeof TouchableOpacityComponent;
5152export class TouchableOpacity extends TouchableOpacityBase {
5153 /**
5154 * Animate the touchable to a new opacity.
5155 */
5156 setOpacityTo: (value: number) => void;
5157}
5158
5159interface BaseBackgroundPropType {
5160 type: string;
5161 rippleRadius?: number | null | undefined;
5162}
5163
5164interface RippleBackgroundPropType extends BaseBackgroundPropType {
5165 type: 'RippleAndroid';
5166 borderless: boolean;
5167 color?: number | null | undefined;
5168}
5169
5170interface ThemeAttributeBackgroundPropType extends BaseBackgroundPropType {
5171 type: 'ThemeAttrAndroid';
5172 attribute: string;
5173}
5174
5175type BackgroundPropType = RippleBackgroundPropType | ThemeAttributeBackgroundPropType;
5176
5177interface TVProps {
5178 /**
5179 * *(Apple TV only)* TV preferred focus (see documentation for the View component).
5180 *
5181 * @platform ios
5182 */
5183 hasTVPreferredFocus?: boolean | undefined;
5184
5185 /**
5186 * Designates the next view to receive focus when the user navigates down. See the Android documentation.
5187 *
5188 * @platform android
5189 */
5190 nextFocusDown?: number | undefined;
5191
5192 /**
5193 * Designates the next view to receive focus when the user navigates forward. See the Android documentation.
5194 *
5195 * @platform android
5196 */
5197 nextFocusForward?: number | undefined;
5198
5199 /**
5200 * Designates the next view to receive focus when the user navigates left. See the Android documentation.
5201 *
5202 * @platform android
5203 */
5204 nextFocusLeft?: number | undefined;
5205
5206 /**
5207 * Designates the next view to receive focus when the user navigates right. See the Android documentation.
5208 *
5209 * @platform android
5210 */
5211 nextFocusRight?: number | undefined;
5212
5213 /**
5214 * Designates the next view to receive focus when the user navigates up. See the Android documentation.
5215 *
5216 * @platform android
5217 */
5218 nextFocusUp?: number | undefined;
5219}
5220
5221/**
5222 * @see https://reactnative.dev/docs/touchablenativefeedback#props
5223 */
5224export interface TouchableNativeFeedbackProps extends TouchableWithoutFeedbackProps, TVProps {
5225 /**
5226 * Determines the type of background drawable that's going to be used to display feedback.
5227 * It takes an object with type property and extra data depending on the type.
5228 * It's recommended to use one of the following static methods to generate that dictionary:
5229 * 1) TouchableNativeFeedback.SelectableBackground() - will create object that represents android theme's
5230 * default background for selectable elements (?android:attr/selectableItemBackground)
5231 * 2) TouchableNativeFeedback.SelectableBackgroundBorderless() - will create object that represent android
5232 * theme's default background for borderless selectable elements
5233 * (?android:attr/selectableItemBackgroundBorderless). Available on android API level 21+
5234 * 3) TouchableNativeFeedback.Ripple(color, borderless) - will create object that represents ripple drawable
5235 * with specified color (as a string). If property borderless evaluates to true the ripple will render
5236 * outside of the view bounds (see native actionbar buttons as an example of that behavior). This background
5237 * type is available on Android API level 21+
5238 */
5239 background?: BackgroundPropType | undefined;
5240 useForeground?: boolean | undefined;
5241}
5242
5243/**
5244 * A wrapper for making views respond properly to touches (Android only).
5245 * On Android this component uses native state drawable to display touch feedback.
5246 * At the moment it only supports having a single View instance as a child node,
5247 * as it's implemented by replacing that View with another instance of RCTView node with some additional properties set.
5248 *
5249 * Background drawable of native feedback touchable can be customized with background property.
5250 *
5251 * @see https://reactnative.dev/docs/touchablenativefeedback#content
5252 */
5253declare class TouchableNativeFeedbackComponent extends React.Component<TouchableNativeFeedbackProps> {}
5254declare const TouchableNativeFeedbackBase: Constructor<TouchableMixin> & typeof TouchableNativeFeedbackComponent;
5255export class TouchableNativeFeedback extends TouchableNativeFeedbackBase {
5256 /**
5257 * Creates an object that represents android theme's default background for
5258 * selectable elements (?android:attr/selectableItemBackground).
5259 *
5260 * @param rippleRadius The radius of ripple effect
5261 */
5262 static SelectableBackground(rippleRadius?: number | null): ThemeAttributeBackgroundPropType;
5263
5264 /**
5265 * Creates an object that represent android theme's default background for borderless
5266 * selectable elements (?android:attr/selectableItemBackgroundBorderless).
5267 * Available on android API level 21+.
5268 *
5269 * @param rippleRadius The radius of ripple effect
5270 */
5271 static SelectableBackgroundBorderless(rippleRadius?: number | null): ThemeAttributeBackgroundPropType;
5272
5273 /**
5274 * Creates an object that represents ripple drawable with specified color (as a
5275 * string). If property `borderless` evaluates to true the ripple will
5276 * render outside of the view bounds (see native actionbar buttons as an
5277 * example of that behavior). This background type is available on Android
5278 * API level 21+.
5279 *
5280 * @param color The ripple color
5281 * @param borderless If the ripple can render outside it's bounds
5282 * @param rippleRadius The radius of ripple effect
5283 */
5284 static Ripple(color: ColorValue, borderless: boolean, rippleRadius?: number | null): RippleBackgroundPropType;
5285 static canUseNativeForeground(): boolean;
5286}
5287
5288export interface Route {
5289 component?: React.ComponentType<any> | undefined;
5290 id?: string | undefined;
5291 title?: string | undefined;
5292 passProps?: Object | undefined;
5293
5294 //anything else
5295 [key: string]: any;
5296
5297 //Commonly found properties
5298 backButtonTitle?: string | undefined;
5299 content?: string | undefined;
5300 message?: string | undefined;
5301 index?: number | undefined;
5302 onRightButtonPress?: (() => void) | undefined;
5303 rightButtonTitle?: string | undefined;
5304 wrapperStyle?: any;
5305}
5306
5307interface InteractionMixin {
5308 createInteractionHandle(): number;
5309 clearInteractionHandle(clearHandle: number): void;
5310 /**
5311 * Schedule work for after all interactions have completed.
5312 *
5313 */
5314 runAfterInteractions(callback: () => any): void;
5315}
5316
5317interface SubscribableMixin {
5318 /**
5319 * Special form of calling `addListener` that *guarantees* that a
5320 * subscription *must* be tied to a component instance, and therefore will
5321 * be cleaned up when the component is unmounted. It is impossible to create
5322 * the subscription and pass it in - this method must be the one to create
5323 * the subscription and therefore can guarantee it is retained in a way that
5324 * will be cleaned up.
5325 *
5326 * @param eventEmitter emitter to subscribe to.
5327 * @param eventType Type of event to listen to.
5328 * @param listener Function to invoke when event occurs.
5329 * @param context Object to use as listener context.
5330 */
5331 addListenerOn(eventEmitter: any, eventType: string, listener: () => any, context: any): void;
5332}
5333
5334// @see https://github.com/facebook/react-native/blob/0.34-stable\Libraries\StyleSheet\StyleSheetTypes.js
5335export namespace StyleSheet {
5336 type NamedStyles<T> = { [P in keyof T]: ViewStyle | TextStyle | ImageStyle };
5337
5338 /**
5339 * Creates a StyleSheet style reference from the given object.
5340 */
5341 export function create<T extends NamedStyles<T> | NamedStyles<any>>(styles: T | NamedStyles<T>): T;
5342
5343 /**
5344 * Flattens an array of style objects, into one aggregated style object.
5345 * Alternatively, this method can be used to lookup IDs, returned by
5346 * StyleSheet.register.
5347 *
5348 * > **NOTE**: Exercise caution as abusing this can tax you in terms of
5349 * > optimizations.
5350 * >
5351 * > IDs enable optimizations through the bridge and memory in general. Referring
5352 * > to style objects directly will deprive you of these optimizations.
5353 *
5354 * Example:
5355 * ```
5356 * const styles = StyleSheet.create({
5357 * listItem: {
5358 * flex: 1,
5359 * fontSize: 16,
5360 * color: 'white'
5361 * },
5362 * selectedListItem: {
5363 * color: 'green'
5364 * }
5365 * });
5366 *
5367 * StyleSheet.flatten([styles.listItem, styles.selectedListItem])
5368 * // returns { flex: 1, fontSize: 16, color: 'green' }
5369 * ```
5370 * Alternative use:
5371 * ```
5372 * StyleSheet.flatten(styles.listItem);
5373 * // return { flex: 1, fontSize: 16, color: 'white' }
5374 * // Simply styles.listItem would return its ID (number)
5375 * ```
5376 * This method internally uses `StyleSheetRegistry.getStyleByID(style)`
5377 * to resolve style objects represented by IDs. Thus, an array of style
5378 * objects (instances of StyleSheet.create), are individually resolved to,
5379 * their respective objects, merged as one and then returned. This also explains
5380 * the alternative use.
5381 */
5382 export function flatten<T>(style?: StyleProp<T>): T extends (infer U)[] ? U : T;
5383
5384 /**
5385 * Combines two styles such that style2 will override any styles in style1.
5386 * If either style is falsy, the other one is returned without allocating
5387 * an array, saving allocations and maintaining reference equality for
5388 * PureComponent checks.
5389 */
5390 export function compose<T>(
5391 style1: StyleProp<T> | Array<StyleProp<T>>,
5392 style2: StyleProp<T> | Array<StyleProp<T>>,
5393 ): StyleProp<T>;
5394
5395 /**
5396 * WARNING: EXPERIMENTAL. Breaking changes will probably happen a lot and will
5397 * not be reliably announced. The whole thing might be deleted, who knows? Use
5398 * at your own risk.
5399 *
5400 * Sets a function to use to pre-process a style property value. This is used
5401 * internally to process color and transform values. You should not use this
5402 * unless you really know what you are doing and have exhausted other options.
5403 */
5404 export function setStyleAttributePreprocessor(property: string, process: (nextProp: any) => any): void;
5405
5406 /**
5407 * This is defined as the width of a thin line on the platform. It can be
5408 * used as the thickness of a border or division between two elements.
5409 * Example:
5410 * ```
5411 * {
5412 * borderBottomColor: '#bbb',
5413 * borderBottomWidth: StyleSheet.hairlineWidth
5414 * }
5415 * ```
5416 *
5417 * This constant will always be a round number of pixels (so a line defined
5418 * by it look crisp) and will try to match the standard width of a thin line
5419 * on the underlying platform. However, you should not rely on it being a
5420 * constant size, because on different platforms and screen densities its
5421 * value may be calculated differently.
5422 */
5423 export const hairlineWidth: number;
5424
5425 interface AbsoluteFillStyle {
5426 position: 'absolute';
5427 left: 0;
5428 right: 0;
5429 top: 0;
5430 bottom: 0;
5431 }
5432
5433 /**
5434 * Sometimes you may want `absoluteFill` but with a couple tweaks - `absoluteFillObject` can be
5435 * used to create a customized entry in a `StyleSheet`, e.g.:
5436 *
5437 * const styles = StyleSheet.create({
5438 * wrapper: {
5439 * ...StyleSheet.absoluteFillObject,
5440 * top: 10,
5441 * backgroundColor: 'transparent',
5442 * },
5443 * });
5444 */
5445 export const absoluteFillObject: AbsoluteFillStyle;
5446
5447 /**
5448 * A very common pattern is to create overlays with position absolute and zero positioning,
5449 * so `absoluteFill` can be used for convenience and to reduce duplication of these repeated
5450 * styles.
5451 */
5452 export const absoluteFill: RegisteredStyle<AbsoluteFillStyle>;
5453}
5454
5455export interface RelayProfiler {
5456 attachProfileHandler(name: string, handler: (name: string, state?: any) => () => void): void;
5457
5458 attachAggregateHandler(name: string, handler: (name: string, callback: () => void) => void): void;
5459}
5460
5461export interface SystraceStatic {
5462 setEnabled(enabled: boolean): void;
5463
5464 /**
5465 * beginEvent/endEvent for starting and then ending a profile within the same call stack frame
5466 **/
5467 beginEvent(profileName?: any, args?: any): void;
5468 endEvent(): void;
5469
5470 /**
5471 * beginAsyncEvent/endAsyncEvent for starting and then ending a profile where the end can either
5472 * occur on another thread or out of the current stack frame, eg await
5473 * the returned cookie variable should be used as input into the endAsyncEvent call to end the profile
5474 **/
5475 beginAsyncEvent(profileName?: any): any;
5476 endAsyncEvent(profileName?: any, cookie?: any): void;
5477
5478 /**
5479 * counterEvent registers the value to the profileName on the systrace timeline
5480 **/
5481 counterEvent(profileName?: any, value?: any): void;
5482
5483 /**
5484 * Relay profiles use await calls, so likely occur out of current stack frame
5485 * therefore async variant of profiling is used
5486 **/
5487 attachToRelayProfiler(relayProfiler: RelayProfiler): void;
5488
5489 /* This is not called by default due to perf overhead but it's useful
5490 if you want to find traces which spend too much time in JSON. */
5491 swizzleJSON(): void;
5492
5493 /**
5494 * Measures multiple methods of a class. For example, you can do:
5495 * Systrace.measureMethods(JSON, 'JSON', ['parse', 'stringify']);
5496 *
5497 * @param methodNames Map from method names to method display names.
5498 */
5499 measureMethods(object: any, objectName: string, methodNames: Array<string>): void;
5500
5501 /**
5502 * Returns an profiled version of the input function. For example, you can:
5503 * JSON.parse = Systrace.measure('JSON', 'parse', JSON.parse);
5504 *
5505 * @return replacement function
5506 */
5507 measure<T extends Function>(objName: string, fnName: string, func: T): T;
5508}
5509
5510/**
5511 * //FIXME: Could not find docs. Inferred from examples and jscode : ListViewDataSource.js
5512 */
5513export interface DataSourceAssetCallback {
5514 rowHasChanged?: ((r1: any, r2: any) => boolean) | undefined;
5515 sectionHeaderHasChanged?: ((h1: any, h2: any) => boolean) | undefined;
5516 getRowData?: ((dataBlob: any, sectionID: number | string, rowID: number | string) => any) | undefined;
5517 getSectionHeaderData?: ((dataBlob: any, sectionID: number | string) => any) | undefined;
5518}
5519
5520/**
5521 * Provides efficient data processing and access to the
5522 * `ListView` component. A `ListViewDataSource` is created with functions for
5523 * extracting data from the input blob, and comparing elements (with default
5524 * implementations for convenience). The input blob can be as simple as an
5525 * array of strings, or an object with rows nested inside section objects.
5526 *
5527 * To update the data in the datasource, use `cloneWithRows` (or
5528 * `cloneWithRowsAndSections` if you care about sections). The data in the
5529 * data source is immutable, so you can't modify it directly. The clone methods
5530 * suck in the new data and compute a diff for each row so ListView knows
5531 * whether to re-render it or not.
5532 */
5533export interface ListViewDataSource {
5534 /**
5535 * You can provide custom extraction and `hasChanged` functions for section
5536 * headers and rows. If absent, data will be extracted with the
5537 * `defaultGetRowData` and `defaultGetSectionHeaderData` functions.
5538 *
5539 * The default extractor expects data of one of the following forms:
5540 *
5541 * { sectionID_1: { rowID_1: <rowData1>, ... }, ... }
5542 *
5543 * or
5544 *
5545 * { sectionID_1: [ <rowData1>, <rowData2>, ... ], ... }
5546 *
5547 * or
5548 *
5549 * [ [ <rowData1>, <rowData2>, ... ], ... ]
5550 *
5551 * The constructor takes in a params argument that can contain any of the
5552 * following:
5553 *
5554 * - getRowData(dataBlob, sectionID, rowID);
5555 * - getSectionHeaderData(dataBlob, sectionID);
5556 * - rowHasChanged(prevRowData, nextRowData);
5557 * - sectionHeaderHasChanged(prevSectionData, nextSectionData);
5558 */
5559 new (onAsset: DataSourceAssetCallback): ListViewDataSource;
5560
5561 /**
5562 * Clones this `ListViewDataSource` with the specified `dataBlob` and
5563 * `rowIdentities`. The `dataBlob` is just an aribitrary blob of data. At
5564 * construction an extractor to get the interesting information was defined
5565 * (or the default was used).
5566 *
5567 * The `rowIdentities` is is a 2D array of identifiers for rows.
5568 * ie. [['a1', 'a2'], ['b1', 'b2', 'b3'], ...]. If not provided, it's
5569 * assumed that the keys of the section data are the row identities.
5570 *
5571 * Note: This function does NOT clone the data in this data source. It simply
5572 * passes the functions defined at construction to a new data source with
5573 * the data specified. If you wish to maintain the existing data you must
5574 * handle merging of old and new data separately and then pass that into
5575 * this function as the `dataBlob`.
5576 */
5577 cloneWithRows(
5578 dataBlob: Array<any> | { [key: string]: any },
5579 rowIdentities?: Array<string | number>,
5580 ): ListViewDataSource;
5581
5582 /**
5583 * This performs the same function as the `cloneWithRows` function but here
5584 * you also specify what your `sectionIdentities` are. If you don't care
5585 * about sections you should safely be able to use `cloneWithRows`.
5586 *
5587 * `sectionIdentities` is an array of identifiers for sections.
5588 * ie. ['s1', 's2', ...]. If not provided, it's assumed that the
5589 * keys of dataBlob are the section identities.
5590 *
5591 * Note: this returns a new object!
5592 */
5593 cloneWithRowsAndSections(
5594 dataBlob: Array<any> | { [key: string]: any },
5595 sectionIdentities?: Array<string | number>,
5596 rowIdentities?: Array<Array<string | number>>,
5597 ): ListViewDataSource;
5598
5599 getRowCount(): number;
5600 getRowAndSectionCount(): number;
5601
5602 /**
5603 * Returns if the row is dirtied and needs to be rerendered
5604 */
5605 rowShouldUpdate(sectionIndex: number, rowIndex: number): boolean;
5606
5607 /**
5608 * Gets the data required to render the row.
5609 */
5610 getRowData(sectionIndex: number, rowIndex: number): any;
5611
5612 /**
5613 * Gets the rowID at index provided if the dataSource arrays were flattened,
5614 * or null of out of range indexes.
5615 */
5616 getRowIDForFlatIndex(index: number): string;
5617
5618 /**
5619 * Gets the sectionID at index provided if the dataSource arrays were flattened,
5620 * or null for out of range indexes.
5621 */
5622 getSectionIDForFlatIndex(index: number): string;
5623
5624 /**
5625 * Returns an array containing the number of rows in each section
5626 */
5627 getSectionLengths(): Array<number>;
5628
5629 /**
5630 * Returns if the section header is dirtied and needs to be rerendered
5631 */
5632 sectionHeaderShouldUpdate(sectionIndex: number): boolean;
5633
5634 /**
5635 * Gets the data required to render the section header
5636 */
5637 getSectionHeaderData(sectionIndex: number): any;
5638}
5639
5640/**
5641 * @see https://reactnative.dev/docs/tabbarios-item#props
5642 */
5643export interface TabBarIOSItemProps extends ViewProps {
5644 /**
5645 * Little red bubble that sits at the top right of the icon.
5646 */
5647 badge?: string | number | undefined;
5648
5649 /**
5650 * Background color for the badge. Available since iOS 10.
5651 */
5652 badgeColor?: ColorValue | undefined;
5653
5654 /**
5655 * A custom icon for the tab. It is ignored when a system icon is defined.
5656 */
5657 icon?: ImageURISource | undefined;
5658
5659 /**
5660 * Callback when this tab is being selected,
5661 * you should change the state of your component to set selected={true}.
5662 */
5663 onPress?: (() => void) | undefined;
5664
5665 /**
5666 * If set to true it renders the image as original,
5667 * it defaults to being displayed as a template
5668 */
5669 renderAsOriginal?: boolean | undefined;
5670
5671 /**
5672 * It specifies whether the children are visible or not. If you see a blank content, you probably forgot to add a selected one.
5673 */
5674 selected?: boolean | undefined;
5675
5676 /**
5677 * A custom icon when the tab is selected.
5678 * It is ignored when a system icon is defined. If left empty, the icon will be tinted in blue.
5679 */
5680 selectedIcon?: ImageURISource | undefined;
5681
5682 /**
5683 * React style object.
5684 */
5685 style?: StyleProp<ViewStyle> | undefined;
5686
5687 /**
5688 * Items comes with a few predefined system icons.
5689 * Note that if you are using them, the title and selectedIcon will be overridden with the system ones.
5690 *
5691 * enum('bookmarks', 'contacts', 'downloads', 'favorites', 'featured', 'history', 'more', 'most-recent', 'most-viewed', 'recents', 'search', 'top-rated')
5692 */
5693 systemIcon?:
5694 | 'bookmarks'
5695 | 'contacts'
5696 | 'downloads'
5697 | 'favorites'
5698 | 'featured'
5699 | 'history'
5700 | 'more'
5701 | 'most-recent'
5702 | 'most-viewed'
5703 | 'recents'
5704 | 'search'
5705 | 'top-rated'
5706 | undefined;
5707
5708 /**
5709 * Text that appears under the icon. It is ignored when a system icon is defined.
5710 */
5711 title?: string | undefined;
5712}
5713
5714export class TabBarIOSItem extends React.Component<TabBarIOSItemProps> {}
5715
5716/**
5717 * @see https://reactnative.dev/docs/tabbarios#props
5718 */
5719export interface TabBarIOSProps extends ViewProps {
5720 /**
5721 * Background color of the tab bar
5722 */
5723 barTintColor?: ColorValue | undefined;
5724
5725 /**
5726 * Specifies tab bar item positioning. Available values are:
5727 * - fill - distributes items across the entire width of the tab bar
5728 * - center - centers item in the available tab bar space
5729 * - auto (default) - distributes items dynamically according to the
5730 * user interface idiom. In a horizontally compact environment (e.g. iPhone 5)
5731 * this value defaults to `fill`, in a horizontally regular one (e.g. iPad)
5732 * it defaults to center.
5733 */
5734 itemPositioning?: 'fill' | 'center' | 'auto' | undefined;
5735
5736 /**
5737 * Color of the currently selected tab icon
5738 */
5739 tintColor?: ColorValue | undefined;
5740
5741 /**
5742 * A Boolean value that indicates whether the tab bar is translucent
5743 */
5744 translucent?: boolean | undefined;
5745
5746 /**
5747 * Color of text on unselected tabs
5748 */
5749 unselectedTintColor?: ColorValue | undefined;
5750
5751 /**
5752 * Color of unselected tab icons. Available since iOS 10.
5753 */
5754 unselectedItemTintColor?: ColorValue | undefined;
5755}
5756
5757/**
5758 * TabBarIOS has been removed from react-native
5759 * @deprecated
5760 */
5761export class TabBarIOS extends React.Component<TabBarIOSProps> {
5762 static Item: typeof TabBarIOSItem;
5763}
5764
5765export interface PixelRatioStatic {
5766 /*
5767 Returns the device pixel density. Some examples:
5768 PixelRatio.get() === 1
5769 mdpi Android devices (160 dpi)
5770 PixelRatio.get() === 1.5
5771 hdpi Android devices (240 dpi)
5772 PixelRatio.get() === 2
5773 iPhone 4, 4S
5774 iPhone 5, 5c, 5s
5775 iPhone 6
5776 xhdpi Android devices (320 dpi)
5777 PixelRatio.get() === 3
5778 iPhone 6 plus
5779 xxhdpi Android devices (480 dpi)
5780 PixelRatio.get() === 3.5
5781 Nexus 6
5782 */
5783 get(): number;
5784
5785 /*
5786 Returns the scaling factor for font sizes. This is the ratio that is
5787 used to calculate the absolute font size, so any elements that
5788 heavily depend on that should use this to do calculations.
5789
5790 If a font scale is not set, this returns the device pixel ratio.
5791
5792 Currently this is only implemented on Android and reflects the user
5793 preference set in Settings > Display > Font size,
5794 on iOS it will always return the default pixel ratio.
5795 */
5796 getFontScale(): number;
5797
5798 /**
5799 * Converts a layout size (dp) to pixel size (px).
5800 * Guaranteed to return an integer number.
5801 */
5802 getPixelSizeForLayoutSize(layoutSize: number): number;
5803
5804 /**
5805 * Rounds a layout size (dp) to the nearest layout size that
5806 * corresponds to an integer number of pixels. For example,
5807 * on a device with a PixelRatio of 3,
5808 * PixelRatio.roundToNearestPixel(8.4) = 8.33,
5809 * which corresponds to exactly (8.33 * 3) = 25 pixels.
5810 */
5811 roundToNearestPixel(layoutSize: number): number;
5812
5813 /**
5814 * No-op for iOS, but used on the web. Should not be documented. [sic]
5815 */
5816 startDetecting(): void;
5817}
5818
5819/**
5820 * @see https://reactnative.dev/docs/platform-specific-code#content
5821 */
5822export type PlatformOSType = 'ios' | 'android' | 'macos' | 'windows' | 'web' | 'native';
5823type PlatformConstants = {
5824 isTesting: boolean;
5825 reactNativeVersion: { major: number; minor: number; patch: number; prerelease?: number | null | undefined };
5826};
5827interface PlatformStatic {
5828 isTV: boolean;
5829 isTesting: boolean;
5830 Version: number | string;
5831 constants: PlatformConstants;
5832
5833 /**
5834 * @see https://reactnative.dev/docs/platform-specific-code#content
5835 */
5836 select<T>(
5837 specifics: ({ [platform in PlatformOSType]?: T } & { default: T }) | { [platform in PlatformOSType]: T },
5838 ): T;
5839 select<T>(specifics: { [platform in PlatformOSType]?: T }): T | undefined;
5840}
5841
5842interface PlatformIOSStatic extends PlatformStatic {
5843 constants: PlatformConstants & {
5844 forceTouchAvailable: boolean;
5845 interfaceIdiom: string;
5846 osVersion: string;
5847 systemName: string;
5848 };
5849 OS: 'ios';
5850 isPad: boolean;
5851 isTVOS: boolean;
5852 Version: string;
5853}
5854
5855interface PlatformAndroidStatic extends PlatformStatic {
5856 constants: PlatformConstants & {
5857 Version: number;
5858 Release: string;
5859 Serial: string;
5860 Fingerprint: string;
5861 Model: string;
5862 Brand: string;
5863 Manufacturer: string;
5864 ServerHost?: string | undefined;
5865 uiMode: 'car' | 'desk' | 'normal' | 'tv' | 'watch' | 'unknown';
5866 };
5867 OS: 'android';
5868 Version: number;
5869}
5870
5871interface PlatformMacOSStatic extends PlatformStatic {
5872 OS: 'macos';
5873 Version: string;
5874 constants: PlatformConstants & {
5875 osVersion: string;
5876 };
5877}
5878
5879interface PlatformWindowsOSStatic extends PlatformStatic {
5880 OS: 'windows';
5881 Version: number;
5882 constants: PlatformConstants & {
5883 osVersion: number;
5884 };
5885}
5886
5887interface PlatformWebStatic extends PlatformStatic {
5888 OS: 'web';
5889}
5890
5891type OpaqueColorValue = symbol & { __TYPE__: 'Color' };
5892export type ColorValue = string | OpaqueColorValue;
5893
5894export type ProcessedColorValue = number | OpaqueColorValue;
5895
5896type DynamicColorIOSTuple = {
5897 light: ColorValue;
5898 dark: ColorValue;
5899 highContrastLight?: ColorValue | undefined;
5900 highContrastDark?: ColorValue | undefined;
5901};
5902
5903/**
5904 * Specify color to display depending on the current system appearance settings
5905 *
5906 * @param tuple Colors you want to use for "light mode" and "dark mode"
5907 * @platform ios
5908 */
5909export function DynamicColorIOS(tuple: DynamicColorIOSTuple): OpaqueColorValue;
5910
5911/**
5912 * Select native platform color
5913 * The color must match the string that exists on the native platform
5914 *
5915 * @see https://reactnative.dev/docs/platformcolor#example
5916 */
5917export function PlatformColor(...colors: string[]): OpaqueColorValue;
5918
5919/**
5920 * Deprecated - subclass NativeEventEmitter to create granular event modules instead of
5921 * adding all event listeners directly to RCTDeviceEventEmitter.
5922 */
5923interface DeviceEventEmitterStatic extends EventEmitter {
5924 sharedSubscriber: EventSubscriptionVendor;
5925 new (): DeviceEventEmitterStatic;
5926 addListener(type: string, listener: (data: any) => void, context?: any): EmitterSubscription;
5927}
5928
5929// Used by Dimensions below
5930export interface ScaledSize {
5931 width: number;
5932 height: number;
5933 scale: number;
5934 fontScale: number;
5935}
5936
5937/**
5938 * Initial dimensions are set before `runApplication` is called so they should
5939 * be available before any other require's are run, but may be updated later.
5940 *
5941 * Note: Although dimensions are available immediately, they may change (e.g
5942 * due to device rotation) so any rendering logic or styles that depend on
5943 * these constants should try to call this function on every render, rather
5944 * than caching the value (for example, using inline styles rather than
5945 * setting a value in a `StyleSheet`).
5946 *
5947 * Example: `const {height, width} = Dimensions.get('window');`
5948 *
5949 * @param dim Name of dimension as defined when calling `set`.
5950 * @returns Value for the dimension.
5951 * @see https://reactnative.dev/docs/dimensions#content
5952 */
5953export interface Dimensions {
5954 /**
5955 * Initial dimensions are set before runApplication is called so they
5956 * should be available before any other require's are run, but may be
5957 * updated later.
5958 * Note: Although dimensions are available immediately, they may
5959 * change (e.g due to device rotation) so any rendering logic or
5960 * styles that depend on these constants should try to call this
5961 * function on every render, rather than caching the value (for
5962 * example, using inline styles rather than setting a value in a
5963 * StyleSheet).
5964 * Example: const {height, width} = Dimensions.get('window');
5965 @param dim Name of dimension as defined when calling set.
5966 @returns Value for the dimension.
5967 */
5968 get(dim: 'window' | 'screen'): ScaledSize;
5969
5970 /**
5971 * This should only be called from native code by sending the didUpdateDimensions event.
5972 * @param dims Simple string-keyed object of dimensions to set
5973 */
5974 set(dims: { [key: string]: any }): void;
5975
5976 /**
5977 * Add an event listener for dimension changes
5978 *
5979 * @param type the type of event to listen to
5980 * @param handler the event handler
5981 */
5982 addEventListener(
5983 type: 'change',
5984 handler: ({ window, screen }: { window: ScaledSize; screen: ScaledSize }) => void,
5985 ): EmitterSubscription;
5986
5987 /**
5988 * Remove an event listener
5989 * @deprecated Use `remove` on the EventSubscription from `addEventListener`.
5990 *
5991 * @param type the type of event
5992 * @param handler the event handler
5993 */
5994 removeEventListener(
5995 type: 'change',
5996 handler: ({ window, screen }: { window: ScaledSize; screen: ScaledSize }) => void,
5997 ): void;
5998}
5999
6000export function useWindowDimensions(): ScaledSize;
6001
6002export type SimpleTask = {
6003 name: string;
6004 gen: () => void;
6005};
6006export type PromiseTask = {
6007 name: string;
6008 gen: () => Promise<any>;
6009};
6010
6011export type Handle = number;
6012
6013export interface InteractionManagerStatic {
6014 Events: {
6015 interactionStart: string;
6016 interactionComplete: string;
6017 };
6018
6019 /**
6020 * Adds a listener to be invoked when events of the specified type are
6021 * emitted. An optional calling context may be provided. The data arguments
6022 * emitted will be passed to the listener function.
6023 *
6024 * @param eventType - Name of the event to listen to
6025 * @param listener - Function to invoke when the specified event is
6026 * emitted
6027 * @param context - Optional context object to use when invoking the
6028 * listener
6029 */
6030 addListener(eventType: string, listener: (...args: any[]) => any, context?: any): EmitterSubscription;
6031
6032 /**
6033 * Schedule a function to run after all interactions have completed.
6034 * Returns a cancellable
6035 */
6036 runAfterInteractions(
6037 task?: (() => any) | SimpleTask | PromiseTask,
6038 ): {
6039 then: (onfulfilled?: () => any, onrejected?: () => any) => Promise<any>;
6040 done: (...args: any[]) => any;
6041 cancel: () => void;
6042 };
6043
6044 /**
6045 * Notify manager that an interaction has started.
6046 */
6047 createInteractionHandle(): Handle;
6048
6049 /**
6050 * Notify manager that an interaction has completed.
6051 */
6052 clearInteractionHandle(handle: Handle): void;
6053
6054 /**
6055 * A positive number will use setTimeout to schedule any tasks after
6056 * the eventLoopRunningTime hits the deadline value, otherwise all
6057 * tasks will be executed in one setImmediate batch (default).
6058 */
6059 setDeadline(deadline: number): void;
6060}
6061
6062export interface ScrollResponderEvent extends NativeSyntheticEvent<NativeTouchEvent> {}
6063
6064interface ScrollResponderMixin extends SubscribableMixin {
6065 /**
6066 * Invoke this from an `onScroll` event.
6067 */
6068 scrollResponderHandleScrollShouldSetResponder(): boolean;
6069
6070 /**
6071 * Merely touch starting is not sufficient for a scroll view to become the
6072 * responder. Being the "responder" means that the very next touch move/end
6073 * event will result in an action/movement.
6074 *
6075 * Invoke this from an `onStartShouldSetResponder` event.
6076 *
6077 * `onStartShouldSetResponder` is used when the next move/end will trigger
6078 * some UI movement/action, but when you want to yield priority to views
6079 * nested inside of the view.
6080 *
6081 * There may be some cases where scroll views actually should return `true`
6082 * from `onStartShouldSetResponder`: Any time we are detecting a standard tap
6083 * that gives priority to nested views.
6084 *
6085 * - If a single tap on the scroll view triggers an action such as
6086 * recentering a map style view yet wants to give priority to interaction
6087 * views inside (such as dropped pins or labels), then we would return true
6088 * from this method when there is a single touch.
6089 *
6090 * - Similar to the previous case, if a two finger "tap" should trigger a
6091 * zoom, we would check the `touches` count, and if `>= 2`, we would return
6092 * true.
6093 *
6094 */
6095 scrollResponderHandleStartShouldSetResponder(): boolean;
6096
6097 /**
6098 * There are times when the scroll view wants to become the responder
6099 * (meaning respond to the next immediate `touchStart/touchEnd`), in a way
6100 * that *doesn't* give priority to nested views (hence the capture phase):
6101 *
6102 * - Currently animating.
6103 * - Tapping anywhere that is not the focused input, while the keyboard is
6104 * up (which should dismiss the keyboard).
6105 *
6106 * Invoke this from an `onStartShouldSetResponderCapture` event.
6107 */
6108 scrollResponderHandleStartShouldSetResponderCapture(e: ScrollResponderEvent): boolean;
6109
6110 /**
6111 * Invoke this from an `onResponderReject` event.
6112 *
6113 * Some other element is not yielding its role as responder. Normally, we'd
6114 * just disable the `UIScrollView`, but a touch has already began on it, the
6115 * `UIScrollView` will not accept being disabled after that. The easiest
6116 * solution for now is to accept the limitation of disallowing this
6117 * altogether. To improve this, find a way to disable the `UIScrollView` after
6118 * a touch has already started.
6119 */
6120 scrollResponderHandleResponderReject(): any;
6121
6122 /**
6123 * We will allow the scroll view to give up its lock iff it acquired the lock
6124 * during an animation. This is a very useful default that happens to satisfy
6125 * many common user experiences.
6126 *
6127 * - Stop a scroll on the left edge, then turn that into an outer view's
6128 * backswipe.
6129 * - Stop a scroll mid-bounce at the top, continue pulling to have the outer
6130 * view dismiss.
6131 * - However, without catching the scroll view mid-bounce (while it is
6132 * motionless), if you drag far enough for the scroll view to become
6133 * responder (and therefore drag the scroll view a bit), any backswipe
6134 * navigation of a swipe gesture higher in the view hierarchy, should be
6135 * rejected.
6136 */
6137 scrollResponderHandleTerminationRequest(): boolean;
6138
6139 /**
6140 * Invoke this from an `onTouchEnd` event.
6141 *
6142 * @param e Event.
6143 */
6144 scrollResponderHandleTouchEnd(e: ScrollResponderEvent): void;
6145
6146 /**
6147 * Invoke this from an `onResponderRelease` event.
6148 */
6149 scrollResponderHandleResponderRelease(e: ScrollResponderEvent): void;
6150
6151 scrollResponderHandleScroll(e: ScrollResponderEvent): void;
6152
6153 /**
6154 * Invoke this from an `onResponderGrant` event.
6155 */
6156 scrollResponderHandleResponderGrant(e: ScrollResponderEvent): void;
6157
6158 /**
6159 * Unfortunately, `onScrollBeginDrag` also fires when *stopping* the scroll
6160 * animation, and there's not an easy way to distinguish a drag vs. stopping
6161 * momentum.
6162 *
6163 * Invoke this from an `onScrollBeginDrag` event.
6164 */
6165 scrollResponderHandleScrollBeginDrag(e: ScrollResponderEvent): void;
6166
6167 /**
6168 * Invoke this from an `onScrollEndDrag` event.
6169 */
6170 scrollResponderHandleScrollEndDrag(e: ScrollResponderEvent): void;
6171
6172 /**
6173 * Invoke this from an `onMomentumScrollBegin` event.
6174 */
6175 scrollResponderHandleMomentumScrollBegin(e: ScrollResponderEvent): void;
6176
6177 /**
6178 * Invoke this from an `onMomentumScrollEnd` event.
6179 */
6180 scrollResponderHandleMomentumScrollEnd(e: ScrollResponderEvent): void;
6181
6182 /**
6183 * Invoke this from an `onTouchStart` event.
6184 *
6185 * Since we know that the `SimpleEventPlugin` occurs later in the plugin
6186 * order, after `ResponderEventPlugin`, we can detect that we were *not*
6187 * permitted to be the responder (presumably because a contained view became
6188 * responder). The `onResponderReject` won't fire in that case - it only
6189 * fires when a *current* responder rejects our request.
6190 *
6191 * @param e Touch Start event.
6192 */
6193 scrollResponderHandleTouchStart(e: ScrollResponderEvent): void;
6194
6195 /**
6196 * Invoke this from an `onTouchMove` event.
6197 *
6198 * Since we know that the `SimpleEventPlugin` occurs later in the plugin
6199 * order, after `ResponderEventPlugin`, we can detect that we were *not*
6200 * permitted to be the responder (presumably because a contained view became
6201 * responder). The `onResponderReject` won't fire in that case - it only
6202 * fires when a *current* responder rejects our request.
6203 *
6204 * @param e Touch Start event.
6205 */
6206 scrollResponderHandleTouchMove(e: ScrollResponderEvent): void;
6207
6208 /**
6209 * A helper function for this class that lets us quickly determine if the
6210 * view is currently animating. This is particularly useful to know when
6211 * a touch has just started or ended.
6212 */
6213 scrollResponderIsAnimating(): boolean;
6214
6215 /**
6216 * Returns the node that represents native view that can be scrolled.
6217 * Components can pass what node to use by defining a `getScrollableNode`
6218 * function otherwise `this` is used.
6219 */
6220 scrollResponderGetScrollableNode(): any;
6221
6222 /**
6223 * A helper function to scroll to a specific point in the scrollview.
6224 * This is currently used to help focus on child textviews, but can also
6225 * be used to quickly scroll to any element we want to focus. Syntax:
6226 *
6227 * scrollResponderScrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true})
6228 *
6229 * Note: The weird argument signature is due to the fact that, for historical reasons,
6230 * the function also accepts separate arguments as an alternative to the options object.
6231 * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
6232 */
6233 scrollResponderScrollTo(
6234 x?: number | { x?: number | undefined; y?: number | undefined; animated?: boolean | undefined },
6235 y?: number,
6236 animated?: boolean,
6237 ): void;
6238
6239 /**
6240 * A helper function to zoom to a specific rect in the scrollview. The argument has the shape
6241 * {x: number; y: number; width: number; height: number; animated: boolean = true}
6242 *
6243 * @platform ios
6244 */
6245 scrollResponderZoomTo(
6246 rect: { x: number; y: number; width: number; height: number; animated?: boolean | undefined },
6247 animated?: boolean, // deprecated, put this inside the rect argument instead
6248 ): void;
6249
6250 /**
6251 * This method should be used as the callback to onFocus in a TextInputs'
6252 * parent view. Note that any module using this mixin needs to return
6253 * the parent view's ref in getScrollViewRef() in order to use this method.
6254 * @param nodeHandle The TextInput node handle
6255 * @param additionalOffset The scroll view's top "contentInset".
6256 * Default is 0.
6257 * @param preventNegativeScrolling Whether to allow pulling the content
6258 * down to make it meet the keyboard's top. Default is false.
6259 */
6260 scrollResponderScrollNativeHandleToKeyboard(
6261 nodeHandle: any,
6262 additionalOffset?: number,
6263 preventNegativeScrollOffset?: boolean,
6264 ): void;
6265
6266 /**
6267 * The calculations performed here assume the scroll view takes up the entire
6268 * screen - even if has some content inset. We then measure the offsets of the
6269 * keyboard, and compensate both for the scroll view's "contentInset".
6270 *
6271 * @param left Position of input w.r.t. table view.
6272 * @param top Position of input w.r.t. table view.
6273 * @param width Width of the text input.
6274 * @param height Height of the text input.
6275 */
6276 scrollResponderInputMeasureAndScrollToKeyboard(left: number, top: number, width: number, height: number): void;
6277
6278 scrollResponderTextInputFocusError(e: ScrollResponderEvent): void;
6279
6280 /**
6281 * `componentWillMount` is the closest thing to a standard "constructor" for
6282 * React components.
6283 *
6284 * The `keyboardWillShow` is called before input focus.
6285 */
6286 componentWillMount(): void;
6287
6288 /**
6289 * Warning, this may be called several times for a single keyboard opening.
6290 * It's best to store the information in this method and then take any action
6291 * at a later point (either in `keyboardDidShow` or other).
6292 *
6293 * Here's the order that events occur in:
6294 * - focus
6295 * - willShow {startCoordinates, endCoordinates} several times
6296 * - didShow several times
6297 * - blur
6298 * - willHide {startCoordinates, endCoordinates} several times
6299 * - didHide several times
6300 *
6301 * The `ScrollResponder` providesModule callbacks for each of these events.
6302 * Even though any user could have easily listened to keyboard events
6303 * themselves, using these `props` callbacks ensures that ordering of events
6304 * is consistent - and not dependent on the order that the keyboard events are
6305 * subscribed to. This matters when telling the scroll view to scroll to where
6306 * the keyboard is headed - the scroll responder better have been notified of
6307 * the keyboard destination before being instructed to scroll to where the
6308 * keyboard will be. Stick to the `ScrollResponder` callbacks, and everything
6309 * will work.
6310 *
6311 * WARNING: These callbacks will fire even if a keyboard is displayed in a
6312 * different navigation pane. Filter out the events to determine if they are
6313 * relevant to you. (For example, only if you receive these callbacks after
6314 * you had explicitly focused a node etc).
6315 */
6316 scrollResponderKeyboardWillShow(e: ScrollResponderEvent): void;
6317
6318 scrollResponderKeyboardWillHide(e: ScrollResponderEvent): void;
6319
6320 scrollResponderKeyboardDidShow(e: ScrollResponderEvent): void;
6321
6322 scrollResponderKeyboardDidHide(e: ScrollResponderEvent): void;
6323}
6324
6325export interface ScrollViewPropsIOS {
6326 /**
6327 * When true the scroll view bounces horizontally when it reaches the end
6328 * even if the content is smaller than the scroll view itself. The default
6329 * value is true when `horizontal={true}` and false otherwise.
6330 */
6331 alwaysBounceHorizontal?: boolean | undefined;
6332 /**
6333 * When true the scroll view bounces vertically when it reaches the end
6334 * even if the content is smaller than the scroll view itself. The default
6335 * value is false when `horizontal={true}` and true otherwise.
6336 */
6337 alwaysBounceVertical?: boolean | undefined;
6338
6339 /**
6340 * Controls whether iOS should automatically adjust the content inset for scroll views that are placed behind a navigation bar or tab bar/ toolbar.
6341 * The default value is true.
6342 */
6343 automaticallyAdjustContentInsets?: boolean | undefined; // true
6344
6345 /**
6346 * Controls whether iOS should automatically adjust the scroll indicator
6347 * insets. The default value is true. Available on iOS 13 and later.
6348 */
6349 automaticallyAdjustsScrollIndicatorInsets?: boolean | undefined;
6350
6351 /**
6352 * When true the scroll view bounces when it reaches the end of the
6353 * content if the content is larger then the scroll view along the axis of
6354 * the scroll direction. When false it disables all bouncing even if
6355 * the `alwaysBounce*` props are true. The default value is true.
6356 */
6357 bounces?: boolean | undefined;
6358 /**
6359 * When true gestures can drive zoom past min/max and the zoom will animate
6360 * to the min/max value at gesture end otherwise the zoom will not exceed
6361 * the limits.
6362 */
6363 bouncesZoom?: boolean | undefined;
6364
6365 /**
6366 * When false once tracking starts won't try to drag if the touch moves.
6367 * The default value is true.
6368 */
6369 canCancelContentTouches?: boolean | undefined;
6370
6371 /**
6372 * When true the scroll view automatically centers the content when the
6373 * content is smaller than the scroll view bounds; when the content is
6374 * larger than the scroll view this property has no effect. The default
6375 * value is false.
6376 */
6377 centerContent?: boolean | undefined;
6378
6379 /**
6380 * The amount by which the scroll view content is inset from the edges of the scroll view.
6381 * Defaults to {0, 0, 0, 0}.
6382 */
6383 contentInset?: Insets | undefined; // zeros
6384
6385 /**
6386 * Used to manually set the starting scroll offset.
6387 * The default value is {x: 0, y: 0}
6388 */
6389 contentOffset?: PointPropType | undefined; // zeros
6390
6391 /**
6392 * This property specifies how the safe area insets are used to modify the content area of the scroll view.
6393 * The default value of this property must be 'automatic'. But the default value is 'never' until RN@0.51.
6394 */
6395 contentInsetAdjustmentBehavior?: 'automatic' | 'scrollableAxes' | 'never' | 'always' | undefined;
6396
6397 /**
6398 * When true the ScrollView will try to lock to only vertical or horizontal
6399 * scrolling while dragging. The default value is false.
6400 */
6401 directionalLockEnabled?: boolean | undefined;
6402
6403 /**
6404 * The style of the scroll indicators.
6405 * - default (the default), same as black.
6406 * - black, scroll indicator is black. This style is good against
6407 * a white content background.
6408 * - white, scroll indicator is white. This style is good against
6409 * a black content background.
6410 */
6411 indicatorStyle?: 'default' | 'black' | 'white' | undefined;
6412
6413 /**
6414 * When set, the scroll view will adjust the scroll position so that the first child
6415 * that is currently visible and at or beyond minIndexForVisible will not change position.
6416 * This is useful for lists that are loading content in both directions, e.g. a chat thread,
6417 * where new messages coming in might otherwise cause the scroll position to jump. A value
6418 * of 0 is common, but other values such as 1 can be used to skip loading spinners or other
6419 * content that should not maintain position.
6420 *
6421 * The optional autoscrollToTopThreshold can be used to make the content automatically scroll
6422 * to the top after making the adjustment if the user was within the threshold of the top
6423 * before the adjustment was made. This is also useful for chat-like applications where you
6424 * want to see new messages scroll into place, but not if the user has scrolled up a ways and
6425 * it would be disruptive to scroll a bunch.
6426 *
6427 * Caveat 1: Reordering elements in the scrollview with this enabled will probably cause
6428 * jumpiness and jank. It can be fixed, but there are currently no plans to do so. For now,
6429 * don't re-order the content of any ScrollViews or Lists that use this feature.
6430 *
6431 * Caveat 2: This uses contentOffset and frame.origin in native code to compute visibility.
6432 * Occlusion, transforms, and other complexity won't be taken into account as to whether
6433 * content is "visible" or not.
6434 */
6435 maintainVisibleContentPosition?: null | {
6436 autoscrollToTopThreshold?: number | null | undefined;
6437 minIndexForVisible: number;
6438 } | undefined;
6439 /**
6440 * The maximum allowed zoom scale. The default value is 1.0.
6441 */
6442 maximumZoomScale?: number | undefined;
6443
6444 /**
6445 * The minimum allowed zoom scale. The default value is 1.0.
6446 */
6447 minimumZoomScale?: number | undefined;
6448
6449 /**
6450 * Called when a scrolling animation ends.
6451 */
6452 onScrollAnimationEnd?: (() => void) | undefined;
6453
6454 /**
6455 * When true, ScrollView allows use of pinch gestures to zoom in and out.
6456 * The default value is true.
6457 */
6458 pinchGestureEnabled?: boolean | undefined;
6459
6460 /**
6461 * This controls how often the scroll event will be fired while scrolling (as a time interval in ms).
6462 * A lower number yields better accuracy for code that is tracking the scroll position,
6463 * but can lead to scroll performance problems due to the volume of information being sent over the bridge.
6464 * The default value is zero, which means the scroll event will be sent only once each time the view is scrolled.
6465 */
6466 scrollEventThrottle?: number | undefined; // null
6467
6468 /**
6469 * The amount by which the scroll view indicators are inset from the edges of the scroll view.
6470 * This should normally be set to the same value as the contentInset.
6471 * Defaults to {0, 0, 0, 0}.
6472 */
6473 scrollIndicatorInsets?: Insets | undefined; //zeroes
6474
6475 /**
6476 * When true, the scroll view can be programmatically scrolled beyond its
6477 * content size. The default value is false.
6478 * @platform ios
6479 */
6480 scrollToOverflowEnabled?: boolean | undefined;
6481
6482 /**
6483 * When true the scroll view scrolls to top when the status bar is tapped.
6484 * The default value is true.
6485 */
6486 scrollsToTop?: boolean | undefined;
6487
6488 /**
6489 * When `snapToInterval` is set, `snapToAlignment` will define the relationship of the the snapping to the scroll view.
6490 * - `start` (the default) will align the snap at the left (horizontal) or top (vertical)
6491 * - `center` will align the snap in the center
6492 * - `end` will align the snap at the right (horizontal) or bottom (vertical)
6493 */
6494 snapToAlignment?: 'start' | 'center' | 'end' | undefined;
6495
6496 /**
6497 * Fires when the scroll view scrolls to top after the status bar has been tapped
6498 * @platform ios
6499 */
6500 onScrollToTop?: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
6501
6502 /**
6503 * The current scale of the scroll view content. The default value is 1.0.
6504 */
6505 zoomScale?: number | undefined;
6506}
6507
6508export interface ScrollViewPropsAndroid {
6509 /**
6510 * Sometimes a scrollview takes up more space than its content fills.
6511 * When this is the case, this prop will fill the rest of the
6512 * scrollview with a color to avoid setting a background and creating
6513 * unnecessary overdraw. This is an advanced optimization that is not
6514 * needed in the general case.
6515 */
6516 endFillColor?: ColorValue | undefined;
6517
6518 /**
6519 * Tag used to log scroll performance on this scroll view. Will force
6520 * momentum events to be turned on (see sendMomentumEvents). This doesn't do
6521 * anything out of the box and you need to implement a custom native
6522 * FpsListener for it to be useful.
6523 * @platform android
6524 */
6525 scrollPerfTag?: string | undefined;
6526
6527 /**
6528 * Used to override default value of overScroll mode.
6529
6530 * Possible values:
6531 * - 'auto' - Default value, allow a user to over-scroll this view only if the content is large enough to meaningfully scroll.
6532 * - 'always' - Always allow a user to over-scroll this view.
6533 * - 'never' - Never allow a user to over-scroll this view.
6534 */
6535 overScrollMode?: 'auto' | 'always' | 'never' | undefined;
6536
6537 /**
6538 * Enables nested scrolling for Android API level 21+. Nested scrolling is supported by default on iOS.
6539 */
6540 nestedScrollEnabled?: boolean | undefined;
6541
6542 /**
6543 * Fades out the edges of the the scroll content.
6544 *
6545 * If the value is greater than 0, the fading edges will be set accordingly
6546 * to the current scroll direction and position,
6547 * indicating if there is more content to show.
6548 *
6549 * The default value is 0.
6550 * @platform android
6551 */
6552 fadingEdgeLength?: number | undefined;
6553
6554 /**
6555 * Causes the scrollbars not to turn transparent when they are not in use. The default value is false.
6556 */
6557 persistentScrollbar?: boolean | undefined;
6558}
6559
6560export interface ScrollViewProps extends ViewProps, ScrollViewPropsIOS, ScrollViewPropsAndroid, Touchable {
6561 /**
6562 * These styles will be applied to the scroll view content container which
6563 * wraps all of the child views. Example:
6564 *
6565 * return (
6566 * <ScrollView contentContainerStyle={styles.contentContainer}>
6567 * </ScrollView>
6568 * );
6569 * ...
6570 * const styles = StyleSheet.create({
6571 * contentContainer: {
6572 * paddingVertical: 20
6573 * }
6574 * });
6575 */
6576 contentContainerStyle?: StyleProp<ViewStyle> | undefined;
6577
6578 /**
6579 * A floating-point number that determines how quickly the scroll view
6580 * decelerates after the user lifts their finger. You may also use string
6581 * shortcuts `"normal"` and `"fast"` which match the underlying iOS settings
6582 * for `UIScrollViewDecelerationRateNormal` and
6583 * `UIScrollViewDecelerationRateFast` respectively.
6584 *
6585 * - `'normal'`: 0.998 on iOS, 0.985 on Android (the default)
6586 * - `'fast'`: 0.99 on iOS, 0.9 on Android
6587 */
6588 decelerationRate?: 'fast' | 'normal' | number | undefined;
6589
6590 /**
6591 * When true the scroll view's children are arranged horizontally in a row
6592 * instead of vertically in a column. The default value is false.
6593 */
6594 horizontal?: boolean | null | undefined;
6595
6596 /**
6597 * If sticky headers should stick at the bottom instead of the top of the
6598 * ScrollView. This is usually used with inverted ScrollViews.
6599 */
6600 invertStickyHeaders?: boolean | undefined;
6601
6602 /**
6603 * Determines whether the keyboard gets dismissed in response to a drag.
6604 * - 'none' (the default) drags do not dismiss the keyboard.
6605 * - 'onDrag' the keyboard is dismissed when a drag begins.
6606 * - 'interactive' the keyboard is dismissed interactively with the drag
6607 * and moves in synchrony with the touch; dragging upwards cancels the
6608 * dismissal.
6609 */
6610 keyboardDismissMode?: 'none' | 'interactive' | 'on-drag' | undefined;
6611
6612 /**
6613 * Determines when the keyboard should stay visible after a tap.
6614 * - 'never' (the default), tapping outside of the focused text input when the keyboard is up dismisses the keyboard. When this happens, children won't receive the tap.
6615 * - 'always', the keyboard will not dismiss automatically, and the scroll view will not catch taps, but children of the scroll view can catch taps.
6616 * - 'handled', the keyboard will not dismiss automatically when the tap was handled by a children, (or captured by an ancestor).
6617 * - false, deprecated, use 'never' instead
6618 * - true, deprecated, use 'always' instead
6619 */
6620 keyboardShouldPersistTaps?: boolean | 'always' | 'never' | 'handled' | undefined;
6621
6622 /**
6623 * Called when scrollable content view of the ScrollView changes.
6624 * Handler function is passed the content width and content height as parameters: (contentWidth, contentHeight)
6625 * It's implemented using onLayout handler attached to the content container which this ScrollView renders.
6626 *
6627 */
6628 onContentSizeChange?: ((w: number, h: number) => void) | undefined;
6629
6630 /**
6631 * Fires at most once per frame during scrolling.
6632 * The frequency of the events can be contolled using the scrollEventThrottle prop.
6633 */
6634 onScroll?: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
6635
6636 /**
6637 * Fires if a user initiates a scroll gesture.
6638 */
6639 onScrollBeginDrag?: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
6640
6641 /**
6642 * Fires when a user has finished scrolling.
6643 */
6644 onScrollEndDrag?: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
6645
6646 /**
6647 * Fires when scroll view has finished moving
6648 */
6649 onMomentumScrollEnd?: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
6650
6651 /**
6652 * Fires when scroll view has begun moving
6653 */
6654 onMomentumScrollBegin?: ((event: NativeSyntheticEvent<NativeScrollEvent>) => void) | undefined;
6655
6656 /**
6657 * When true the scroll view stops on multiples of the scroll view's size
6658 * when scrolling. This can be used for horizontal pagination. The default
6659 * value is false.
6660 */
6661 pagingEnabled?: boolean | undefined;
6662
6663 /**
6664 * When false, the content does not scroll. The default value is true
6665 */
6666 scrollEnabled?: boolean | undefined; // true
6667
6668 /**
6669 * Experimental: When true offscreen child views (whose `overflow` value is
6670 * `hidden`) are removed from their native backing superview when offscreen.
6671 * This can improve scrolling performance on long lists. The default value is
6672 * false.
6673 */
6674 removeClippedSubviews?: boolean | undefined;
6675
6676 /**
6677 * When true, shows a horizontal scroll indicator.
6678 */
6679 showsHorizontalScrollIndicator?: boolean | undefined;
6680
6681 /**
6682 * When true, shows a vertical scroll indicator.
6683 */
6684 showsVerticalScrollIndicator?: boolean | undefined;
6685
6686 /**
6687 * When true, Sticky header is hidden when scrolling down, and dock at the top when scrolling up.
6688 */
6689 stickyHeaderHiddenOnScroll?: boolean;
6690
6691 /**
6692 * Style
6693 */
6694 style?: StyleProp<ViewStyle> | undefined;
6695
6696 /**
6697 * A RefreshControl component, used to provide pull-to-refresh
6698 * functionality for the ScrollView.
6699 */
6700 refreshControl?: React.ReactElement<RefreshControlProps> | undefined;
6701
6702 /**
6703 * When set, causes the scroll view to stop at multiples of the value of `snapToInterval`.
6704 * This can be used for paginating through children that have lengths smaller than the scroll view.
6705 * Used in combination with `snapToAlignment` and `decelerationRate="fast"`. Overrides less
6706 * configurable `pagingEnabled` prop.
6707 */
6708 snapToInterval?: number | undefined;
6709
6710 /**
6711 * When set, causes the scroll view to stop at the defined offsets. This can be used for
6712 * paginating through variously sized children that have lengths smaller than the scroll view.
6713 * Typically used in combination with `decelerationRate="fast"`. Overrides less configurable
6714 * `pagingEnabled` and `snapToInterval` props.
6715 */
6716 snapToOffsets?: number[] | undefined;
6717
6718 /**
6719 * Use in conjunction with `snapToOffsets`. By default, the beginning of the list counts as a
6720 * snap offset. Set `snapToStart` to false to disable this behavior and allow the list to scroll
6721 * freely between its start and the first `snapToOffsets` offset. The default value is true.
6722 */
6723 snapToStart?: boolean | undefined;
6724
6725 /**
6726 * Use in conjunction with `snapToOffsets`. By default, the end of the list counts as a snap
6727 * offset. Set `snapToEnd` to false to disable this behavior and allow the list to scroll freely
6728 * between its end and the last `snapToOffsets` offset. The default value is true.
6729 */
6730 snapToEnd?: boolean | undefined;
6731
6732 /**
6733 * An array of child indices determining which children get docked to the
6734 * top of the screen when scrolling. For example passing
6735 * `stickyHeaderIndices={[0]}` will cause the first child to be fixed to the
6736 * top of the scroll view. This property is not supported in conjunction
6737 * with `horizontal={true}`.
6738 */
6739 stickyHeaderIndices?: number[] | undefined;
6740
6741 /**
6742 * When true, the scroll view stops on the next index (in relation to scroll position at release)
6743 * regardless of how fast the gesture is. This can be used for horizontal pagination when the page
6744 * is less than the width of the ScrollView. The default value is false.
6745 */
6746 disableIntervalMomentum?: boolean | undefined;
6747
6748 /**
6749 * When true, the default JS pan responder on the ScrollView is disabled, and full control over
6750 * touches inside the ScrollView is left to its child components. This is particularly useful
6751 * if `snapToInterval` is enabled, since it does not follow typical touch patterns. Do not use
6752 * this on regular ScrollView use cases without `snapToInterval` as it may cause unexpected
6753 * touches to occur while scrolling. The default value is false.
6754 */
6755 disableScrollViewPanResponder?: boolean | undefined;
6756
6757 /**
6758 * A React Component that will be used to render sticky headers, should be used together with
6759 * stickyHeaderIndices. You may need to set this component if your sticky header uses custom
6760 * transforms, for example, when you want your list to have an animated and hidable header.
6761 * If component have not been provided, the default ScrollViewStickyHeader component will be used.
6762 */
6763 StickyHeaderComponent?: React.ComponentType<any> | undefined;
6764}
6765
6766declare class ScrollViewComponent extends React.Component<ScrollViewProps> {}
6767declare const ScrollViewBase: Constructor<ScrollResponderMixin> & typeof ScrollViewComponent;
6768export class ScrollView extends ScrollViewBase {
6769 /**
6770 * Scrolls to a given x, y offset, either immediately or with a smooth animation.
6771 * Syntax:
6772 *
6773 * scrollTo(options: {x: number = 0; y: number = 0; animated: boolean = true})
6774 *
6775 * Note: The weird argument signature is due to the fact that, for historical reasons,
6776 * the function also accepts separate arguments as an alternative to the options object.
6777 * This is deprecated due to ambiguity (y before x), and SHOULD NOT BE USED.
6778 */
6779 scrollTo(y?: number | { x?: number | undefined; y?: number | undefined; animated?: boolean | undefined }, x?: number, animated?: boolean): void;
6780
6781 /**
6782 * A helper function that scrolls to the end of the scrollview;
6783 * If this is a vertical ScrollView, it scrolls to the bottom.
6784 * If this is a horizontal ScrollView scrolls to the right.
6785 *
6786 * The options object has an animated prop, that enables the scrolling animation or not.
6787 * The animated prop defaults to true
6788 */
6789 scrollToEnd(options?: { animated: boolean }): void;
6790
6791 /**
6792 * Displays the scroll indicators momentarily.
6793 */
6794 flashScrollIndicators(): void;
6795
6796 /**
6797 * Returns a reference to the underlying scroll responder, which supports
6798 * operations like `scrollTo`. All ScrollView-like components should
6799 * implement this method so that they can be composed while providing access
6800 * to the underlying scroll responder's methods.
6801 */
6802 getScrollResponder(): ScrollResponderMixin;
6803
6804 getScrollableNode(): any;
6805
6806 // Undocumented
6807 getInnerViewNode(): any;
6808
6809 /**
6810 * @deprecated Use scrollTo instead
6811 */
6812 scrollWithoutAnimationTo?: ((y: number, x: number) => void) | undefined;
6813
6814 /**
6815 * This function sends props straight to native. They will not participate in
6816 * future diff process - this means that if you do not include them in the
6817 * next render, they will remain active (see [Direct
6818 * Manipulation](https://reactnative.dev/docs/direct-manipulation)).
6819 */
6820 setNativeProps(nativeProps: object): void;
6821}
6822
6823export interface NativeScrollRectangle {
6824 left: number;
6825 top: number;
6826 bottom: number;
6827 right: number;
6828}
6829
6830export interface NativeScrollPoint {
6831 x: number;
6832 y: number;
6833}
6834
6835export interface NativeScrollVelocity {
6836 x: number;
6837 y: number;
6838}
6839
6840export interface NativeScrollSize {
6841 height: number;
6842 width: number;
6843}
6844
6845export interface NativeScrollEvent {
6846 contentInset: NativeScrollRectangle;
6847 contentOffset: NativeScrollPoint;
6848 contentSize: NativeScrollSize;
6849 layoutMeasurement: NativeScrollSize;
6850 velocity?: NativeScrollVelocity | undefined;
6851 zoomScale: number;
6852 /**
6853 * @platform ios
6854 */
6855 targetContentOffset?: NativeScrollPoint | undefined;
6856}
6857
6858export interface SnapshotViewIOSProps extends ViewProps {
6859 // A callback when the Snapshot view is ready to be compared
6860 onSnapshotReady(): any;
6861
6862 // A name to identify the individual instance to the SnapshotView
6863 testIdentifier: string;
6864}
6865
6866declare class SnapshotViewIOSComponent extends React.Component<SnapshotViewIOSProps> {}
6867declare const SnapshotViewIOSBase: Constructor<NativeMethods> & typeof SnapshotViewIOSComponent;
6868export class SnapshotViewIOS extends SnapshotViewIOSBase {}
6869
6870// Deduced from
6871// https://github.com/facebook/react-native/commit/052cd7eb8afa7a805ef13e940251be080499919c
6872
6873/**
6874 * Data source wrapper around ListViewDataSource to allow for tracking of
6875 * which row is swiped open and close opened row(s) when another row is swiped
6876 * open.
6877 *
6878 * See https://github.com/facebook/react-native/pull/5602 for why
6879 * ListViewDataSource is not subclassed.
6880 */
6881export interface SwipeableListViewDataSource {
6882 cloneWithRowsAndSections(
6883 dataBlob: any,
6884 sectionIdentities?: Array<string>,
6885 rowIdentities?: Array<Array<string>>,
6886 ): SwipeableListViewDataSource;
6887 getDataSource(): ListViewDataSource;
6888 getOpenRowID(): string;
6889 getFirstRowID(): string;
6890 setOpenRowID(rowID: string): SwipeableListViewDataSource;
6891}
6892
6893export interface SwipeableListViewProps {
6894 /**
6895 * To alert the user that swiping is possible, the first row can bounce
6896 * on component mount.
6897 */
6898 bounceFirstRowOnMount: boolean;
6899
6900 /**
6901 * Use `SwipeableListView.getNewDataSource()` to get a data source to use,
6902 * then use it just like you would a normal ListView data source
6903 */
6904 dataSource: SwipeableListViewDataSource;
6905
6906 // Maximum distance to open to after a swipe
6907 maxSwipeDistance: number;
6908
6909 // Callback method to render the swipeable view
6910 renderRow: (
6911 rowData: any,
6912 sectionID: string | number,
6913 rowID: string | number,
6914 highlightRow?: boolean,
6915 ) => React.ReactElement;
6916
6917 // Callback method to render the view that will be unveiled on swipe
6918 renderQuickActions(rowData: any, sectionID: string | number, rowID: string | number): React.ReactElement;
6919}
6920
6921/**
6922 * SwipeableListView has been removed from React Native.
6923 * See https://fb.me/nolistview for more information or use `deprecated-react-native-swipeable-listview`.
6924 * @deprecated
6925 */
6926export class SwipeableListView extends React.Component<SwipeableListViewProps> {
6927 static getNewDataSource(): SwipeableListViewDataSource;
6928}
6929
6930//////////////////////////////////////////////////////////////////////////
6931//
6932// A P I s
6933//
6934//////////////////////////////////////////////////////////////////////////
6935
6936/**
6937 * @see: https://reactnative.dev/docs/actionsheetios#content
6938 */
6939export interface ActionSheetIOSOptions {
6940 title?: string | undefined;
6941 options: string[];
6942 cancelButtonIndex?: number | undefined;
6943 destructiveButtonIndex?: number | number[] | undefined | null;
6944 message?: string | undefined;
6945 anchor?: number | undefined;
6946 tintColor?: ColorValue | ProcessedColorValue | undefined;
6947 userInterfaceStyle?: 'light' | 'dark' | undefined;
6948 disabledButtonIndices?: number[] | undefined;
6949}
6950
6951export interface ShareActionSheetIOSOptions {
6952 message?: string | undefined;
6953 url?: string | undefined;
6954 subject?: string | undefined;
6955 /** The activities to exclude from the ActionSheet.
6956 * For example: ['com.apple.UIKit.activity.PostToTwitter']
6957 */
6958 excludedActivityTypes?: string[] | undefined;
6959}
6960
6961/**
6962 * @see https://reactnative.dev/docs/actionsheetios#content
6963 */
6964export interface ActionSheetIOSStatic {
6965 /**
6966 * Display an iOS action sheet. The `options` object must contain one or more
6967 * of:
6968 * - `options` (array of strings) - a list of button titles (required)
6969 * - `cancelButtonIndex` (int) - index of cancel button in `options`
6970 * - `destructiveButtonIndex` (int) - index of destructive button in `options`
6971 * - `title` (string) - a title to show above the action sheet
6972 * - `message` (string) - a message to show below the title
6973 */
6974 showActionSheetWithOptions: (options: ActionSheetIOSOptions, callback: (buttonIndex: number) => void) => void;
6975
6976 /**
6977 * Display the iOS share sheet. The `options` object should contain
6978 * one or both of `message` and `url` and can additionally have
6979 * a `subject` or `excludedActivityTypes`:
6980 *
6981 * - `url` (string) - a URL to share
6982 * - `message` (string) - a message to share
6983 * - `subject` (string) - a subject for the message
6984 * - `excludedActivityTypes` (array) - the activities to exclude from the ActionSheet
6985 *
6986 * NOTE: if `url` points to a local file, or is a base64-encoded
6987 * uri, the file it points to will be loaded and shared directly.
6988 * In this way, you can share images, videos, PDF files, etc.
6989 */
6990 showShareActionSheetWithOptions: (
6991 options: ShareActionSheetIOSOptions,
6992 failureCallback: (error: Error) => void,
6993 successCallback: (success: boolean, method: string) => void,
6994 ) => void;
6995}
6996
6997export type ShareContent =
6998 | {
6999 title?: string | undefined;
7000 message: string;
7001 }
7002 | {
7003 title?: string | undefined;
7004 url: string;
7005 };
7006
7007export type ShareOptions = {
7008 dialogTitle?: string | undefined;
7009 excludedActivityTypes?: Array<string> | undefined;
7010 tintColor?: ColorValue | undefined;
7011 subject?: string | undefined;
7012};
7013
7014export type ShareSharedAction = {
7015 action: 'sharedAction';
7016 activityType?: string | undefined;
7017};
7018
7019export type ShareDismissedAction = {
7020 action: 'dismissedAction';
7021};
7022
7023export type ShareAction = ShareSharedAction | ShareDismissedAction;
7024
7025export interface ShareStatic {
7026 /**
7027 * Open a dialog to share text content.
7028 *
7029 * In iOS, Returns a Promise which will be invoked an object containing `action`, `activityType`.
7030 * If the user dismissed the dialog, the Promise will still be resolved with action being `Share.dismissedAction`
7031 * and all the other keys being undefined.
7032 *
7033 * In Android, Returns a Promise which always be resolved with action being `Share.sharedAction`.
7034 *
7035 * ### Content
7036 *
7037 * - `message` - a message to share
7038 * - `title` - title of the message
7039 *
7040 * #### iOS
7041 *
7042 * - `url` - an URL to share
7043 *
7044 * At least one of URL and message is required.
7045 *
7046 * ### Options
7047 *
7048 * #### iOS
7049 *
7050 * - `excludedActivityTypes`
7051 * - `tintColor`
7052 *
7053 * #### Android
7054 *
7055 * - `dialogTitle`
7056 *
7057 */
7058 share(content: ShareContent, options?: ShareOptions): Promise<ShareAction>;
7059 sharedAction: 'sharedAction';
7060 dismissedAction: 'dismissedAction';
7061}
7062
7063type AccessibilityChangeEventName =
7064 | 'change' // deprecated, maps to screenReaderChanged
7065 | 'boldTextChanged' // iOS-only Event
7066 | 'grayscaleChanged' // iOS-only Event
7067 | 'invertColorsChanged' // iOS-only Event
7068 | 'reduceMotionChanged'
7069 | 'screenReaderChanged'
7070 | 'reduceTransparencyChanged'; // iOS-only Event
7071
7072type AccessibilityChangeEvent = boolean;
7073
7074type AccessibilityChangeEventHandler = (event: AccessibilityChangeEvent) => void;
7075
7076type AccessibilityAnnouncementEventName = 'announcementFinished'; // iOS-only Event
7077
7078type AccessibilityAnnouncementFinishedEvent = {
7079 announcement: string;
7080 success: boolean;
7081};
7082
7083type AccessibilityAnnouncementFinishedEventHandler = (event: AccessibilityAnnouncementFinishedEvent) => void;
7084
7085/**
7086 * @see https://reactnative.dev/docs/accessibilityinfo
7087 */
7088export interface AccessibilityInfoStatic {
7089 /**
7090 * Query whether bold text is currently enabled.
7091 *
7092 * @platform ios
7093 */
7094 isBoldTextEnabled: () => Promise<boolean>;
7095
7096 /**
7097 * Query whether grayscale is currently enabled.
7098 *
7099 * @platform ios
7100 */
7101 isGrayscaleEnabled: () => Promise<boolean>;
7102
7103 /**
7104 * Query whether invert colors is currently enabled.
7105 *
7106 * @platform ios
7107 */
7108 isInvertColorsEnabled: () => Promise<boolean>;
7109
7110 /**
7111 * Query whether reduce motion is currently enabled.
7112 */
7113 isReduceMotionEnabled: () => Promise<boolean>;
7114
7115 /**
7116 * Query whether reduce transparency is currently enabled.
7117 *
7118 * @platform ios
7119 */
7120 isReduceTransparencyEnabled: () => Promise<boolean>;
7121
7122 /**
7123 * Query whether a screen reader is currently enabled.
7124 */
7125 isScreenReaderEnabled: () => Promise<boolean>;
7126
7127 /**
7128 * Add an event handler. Supported events:
7129 * - announcementFinished: iOS-only event. Fires when the screen reader has finished making an announcement.
7130 * The argument to the event handler is a dictionary with these keys:
7131 * - announcement: The string announced by the screen reader.
7132 * - success: A boolean indicating whether the announcement was successfully made.
7133 * - AccessibilityEventName constants other than announcementFinished: Fires on accessibility feature change.
7134 * The argument to the event handler is a boolean.
7135 * The boolean is true when the related event's feature is enabled and false otherwise.
7136 *
7137 */
7138 addEventListener(eventName: AccessibilityChangeEventName, handler: AccessibilityChangeEventHandler): EmitterSubscription;
7139 addEventListener(
7140 eventName: AccessibilityAnnouncementEventName,
7141 handler: AccessibilityAnnouncementFinishedEventHandler,
7142 ): EmitterSubscription;
7143
7144 /**
7145 * @deprecated Use the `remove()` method on the event subscription returned by `addEventListener()`.
7146 *
7147 * Remove an event handler
7148 */
7149 removeEventListener(eventName: AccessibilityChangeEventName, handler: AccessibilityChangeEventHandler): void;
7150 removeEventListener(
7151 eventName: AccessibilityAnnouncementEventName,
7152 handler: AccessibilityAnnouncementFinishedEventHandler,
7153 ): void;
7154
7155 /**
7156 * Set accessibility focus to a react component.
7157 */
7158 setAccessibilityFocus: (reactTag: number) => void;
7159
7160 /**
7161 * Post a string to be announced by the screen reader.
7162 */
7163 announceForAccessibility: (announcement: string) => void;
7164
7165 /**
7166 * Gets the timeout in millisecond that the user needs.
7167 * This value is set in "Time to take action (Accessibility timeout)" of "Accessibility" settings.
7168 *
7169 * @platform android
7170 */
7171 getRecommendedTimeoutMillis: (originalTimeout: number) => Promise<number>;
7172}
7173
7174/**
7175 * @see https://reactnative.dev/docs/alert#content
7176 */
7177export interface AlertButton {
7178 text?: string | undefined;
7179 onPress?: ((value?: string) => void) | undefined;
7180 style?: 'default' | 'cancel' | 'destructive' | undefined;
7181}
7182
7183interface AlertOptions {
7184 /** @platform android */
7185 cancelable?: boolean | undefined;
7186 /** @platform android */
7187 onDismiss?: (() => void) | undefined;
7188}
7189
7190/**
7191 * Launches an alert dialog with the specified title and message.
7192 *
7193 * Optionally provide a list of buttons. Tapping any button will fire the
7194 * respective onPress callback and dismiss the alert. By default, the only
7195 * button will be an 'OK' button.
7196 *
7197 * This is an API that works both on iOS and Android and can show static
7198 * alerts. To show an alert that prompts the user to enter some information,
7199 * see `AlertIOS`; entering text in an alert is common on iOS only.
7200 *
7201 * ## iOS
7202 *
7203 * On iOS you can specify any number of buttons. Each button can optionally
7204 * specify a style, which is one of 'default', 'cancel' or 'destructive'.
7205 *
7206 * ## Android
7207 *
7208 * On Android at most three buttons can be specified. Android has a concept
7209 * of a neutral, negative and a positive button:
7210 *
7211 * - If you specify one button, it will be the 'positive' one (such as 'OK')
7212 * - Two buttons mean 'negative', 'positive' (such as 'Cancel', 'OK')
7213 * - Three buttons mean 'neutral', 'negative', 'positive' (such as 'Later', 'Cancel', 'OK')
7214 *
7215 * ```
7216 * // Works on both iOS and Android
7217 * Alert.alert(
7218 * 'Alert Title',
7219 * 'My Alert Msg',
7220 * [
7221 * {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
7222 * {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
7223 * {text: 'OK', onPress: () => console.log('OK Pressed')},
7224 * ]
7225 * )
7226 * ```
7227 */
7228export interface AlertStatic {
7229 alert: (title: string, message?: string, buttons?: AlertButton[], options?: AlertOptions) => void;
7230 prompt: (
7231 title: string,
7232 message?: string,
7233 callbackOrButtons?: ((text: string) => void) | AlertButton[],
7234 type?: AlertType,
7235 defaultValue?: string,
7236 keyboardType?: string,
7237 ) => void;
7238}
7239
7240export type AlertType = 'default' | 'plain-text' | 'secure-text' | 'login-password';
7241
7242/**
7243 * AppState can tell you if the app is in the foreground or background,
7244 * and notify you when the state changes.
7245 *
7246 * AppState is frequently used to determine the intent and proper behavior
7247 * when handling push notifications.
7248 *
7249 * App State Events
7250 * change - This even is received when the app state has changed.
7251 * focus [Android] - Received when the app gains focus (the user is interacting with the app).
7252 * blur [Android] - Received when the user is not actively interacting with the app.
7253 *
7254 * App States
7255 * active - The app is running in the foreground
7256 * background - The app is running in the background. The user is either in another app or on the home screen
7257 * inactive [iOS] - This is a transition state that currently never happens for typical React Native apps.
7258 * unknown [iOS] - Initial value until the current app state is determined
7259 * extension [iOS] - The app is running as an app extension
7260 *
7261 * For more information, see Apple's documentation: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/TheAppLifeCycle/TheAppLifeCycle.html
7262 *
7263 * @see https://reactnative.dev/docs/appstate#app-states
7264 */
7265export type AppStateEvent = 'change' | 'memoryWarning' | 'blur' | 'focus';
7266export type AppStateStatus = 'active' | 'background' | 'inactive' | 'unknown' | 'extension';
7267
7268export interface AppStateStatic {
7269 currentState: AppStateStatus;
7270 isAvailable: boolean;
7271
7272 /**
7273 * Add a handler to AppState changes by listening to the change event
7274 * type and providing the handler
7275 */
7276 addEventListener(type: AppStateEvent, listener: (state: AppStateStatus) => void): NativeEventSubscription;
7277
7278 /**
7279 * @deprecated Use the `remove()` method on the event subscription returned by `addEventListener()`.
7280 *
7281 * Remove a handler by passing the change event type and the handler
7282 */
7283 removeEventListener(type: AppStateEvent, listener: (state: AppStateStatus) => void): void;
7284}
7285
7286/**
7287 * AsyncStorage is a simple, unencrypted, asynchronous, persistent, key-value storage
7288 * system that is global to the app. It should be used instead of LocalStorage.
7289 *
7290 * It is recommended that you use an abstraction on top of `AsyncStorage`
7291 * instead of `AsyncStorage` directly for anything more than light usage since
7292 * it operates globally.
7293 *
7294 * On iOS, `AsyncStorage` is backed by native code that stores small values in a
7295 * serialized dictionary and larger values in separate files. On Android,
7296 * `AsyncStorage` will use either [RocksDB](http://rocksdb.org/) or SQLite
7297 * based on what is available.
7298 *
7299 * @see https://reactnative.dev/docs/asyncstorage#content
7300 */
7301export interface AsyncStorageStatic {
7302 /**
7303 * Fetches key and passes the result to callback, along with an Error if there is any.
7304 */
7305 getItem(key: string, callback?: (error?: Error, result?: string) => void): Promise<string | null>;
7306
7307 /**
7308 * Sets value for key and calls callback on completion, along with an Error if there is any
7309 */
7310 setItem(key: string, value: string, callback?: (error?: Error) => void): Promise<void>;
7311
7312 removeItem(key: string, callback?: (error?: Error) => void): Promise<void>;
7313
7314 /**
7315 * Merges existing value with input value, assuming they are stringified json. Returns a Promise object.
7316 * Not supported by all native implementation
7317 */
7318 mergeItem(key: string, value: string, callback?: (error?: Error) => void): Promise<void>;
7319
7320 /**
7321 * Erases all AsyncStorage for all clients, libraries, etc. You probably don't want to call this.
7322 * Use removeItem or multiRemove to clear only your own keys instead.
7323 */
7324 clear(callback?: (error?: Error) => void): Promise<void>;
7325
7326 /**
7327 * Gets all keys known to the app, for all callers, libraries, etc
7328 */
7329 getAllKeys(callback?: (error?: Error, keys?: string[]) => void): Promise<string[]>;
7330
7331 /**
7332 * multiGet invokes callback with an array of key-value pair arrays that matches the input format of multiSet
7333 */
7334 multiGet(
7335 keys: string[],
7336 callback?: (errors?: Error[], result?: [string, string][]) => void,
7337 ): Promise<[string, string][]>;
7338
7339 /**
7340 * multiSet and multiMerge take arrays of key-value array pairs that match the output of multiGet,
7341 *
7342 * multiSet([['k1', 'val1'], ['k2', 'val2']], cb);
7343 */
7344 multiSet(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<void>;
7345
7346 /**
7347 * Delete all the keys in the keys array.
7348 */
7349 multiRemove(keys: string[], callback?: (errors?: Error[]) => void): Promise<void>;
7350
7351 /**
7352 * Merges existing values with input values, assuming they are stringified json.
7353 * Returns a Promise object.
7354 *
7355 * Not supported by all native implementations.
7356 */
7357 multiMerge(keyValuePairs: string[][], callback?: (errors?: Error[]) => void): Promise<void>;
7358}
7359
7360export type BackPressEventName = 'hardwareBackPress';
7361
7362/**
7363 * Detect hardware back button presses, and programmatically invoke the
7364 * default back button functionality to exit the app if there are no
7365 * listeners or if none of the listeners return true.
7366 * The event subscriptions are called in reverse order
7367 * (i.e. last registered subscription first), and if one subscription
7368 * returns true then subscriptions registered earlier
7369 * will not be called.
7370 *
7371 * @see https://reactnative.dev/docs/backhandler
7372 */
7373export interface BackHandlerStatic {
7374 exitApp(): void;
7375 addEventListener(eventName: BackPressEventName, handler: () => boolean | null | undefined): NativeEventSubscription;
7376 removeEventListener(eventName: BackPressEventName, handler: () => boolean | null | undefined): void;
7377}
7378
7379export interface ButtonProps
7380 extends Pick<
7381 TouchableNativeFeedbackProps & TouchableOpacityProps,
7382 | "accessibilityLabel"
7383 | "accessibilityState"
7384 | "hasTVPreferredFocus"
7385 | "nextFocusDown"
7386 | "nextFocusForward"
7387 | "nextFocusLeft"
7388 | "nextFocusRight"
7389 | "nextFocusUp"
7390 | "testID"
7391 | "disabled"
7392 | "onPress"
7393 | "touchSoundDisabled"
7394 > {
7395 /**
7396 * Text to display inside the button. On Android the given title will be converted to the uppercased form.
7397 */
7398 title: string;
7399
7400 /**
7401 * Color of the text (iOS), or background color of the button (Android).
7402 */
7403 color?: ColorValue | undefined;
7404}
7405
7406export class Button extends React.Component<ButtonProps> {}
7407
7408export type CameraRollGroupType = 'Album' | 'All' | 'Event' | 'Faces' | 'Library' | 'PhotoStream' | 'SavedPhotos';
7409export type CameraRollAssetType = 'All' | 'Videos' | 'Photos';
7410
7411export interface CameraRollFetchParams {
7412 first: number;
7413 after?: string | undefined;
7414 groupTypes?: CameraRollGroupType | undefined;
7415 groupName?: string | undefined;
7416 assetType?: CameraRollAssetType | undefined;
7417}
7418
7419export interface CameraRollNodeInfo {
7420 image: Image;
7421 group_name: string;
7422 timestamp: number;
7423 location: any;
7424}
7425
7426export interface CameraRollEdgeInfo {
7427 node: CameraRollNodeInfo;
7428}
7429
7430export interface CameraRollAssetInfo {
7431 edges: CameraRollEdgeInfo[];
7432 page_info: {
7433 has_next_page: boolean;
7434 end_cursor: string;
7435 };
7436}
7437
7438export interface GetPhotosParamType {
7439 first: number;
7440 after?: string | undefined;
7441 groupTypes?: CameraRollGroupType | undefined;
7442 groupName?: string | undefined;
7443 assetType?: CameraRollAssetType | undefined;
7444 mimeTypes?: string[] | undefined;
7445}
7446
7447export interface GetPhotosReturnType {
7448 edges: {
7449 node: {
7450 type: string;
7451 group_name: string;
7452 image: {
7453 uri: string;
7454 height: number;
7455 width: number;
7456 playableDuration: number;
7457 isStored?: boolean | undefined;
7458 };
7459 timestamp: number;
7460 location: {
7461 latitude: number;
7462 longitude: number;
7463 altitude: number;
7464 heading: number;
7465 speed: number;
7466 };
7467 };
7468 }[];
7469
7470 page_info: {
7471 has_next_page: boolean;
7472 start_cursor?: string | undefined;
7473 end_cursor?: string | undefined;
7474 };
7475}
7476
7477/**
7478 * CameraRoll provides access to the local camera roll / gallery.
7479 * Before using this you must link the RCTCameraRoll library.
7480 * You can refer to (Linking)[https://reactnative.dev/docs/linking-libraries-ios] for help.
7481 */
7482export interface CameraRollStatic {
7483 GroupTypesOptions: CameraRollGroupType[]; //'Album','All','Event','Faces','Library','PhotoStream','SavedPhotos'
7484 AssetTypeOptions: CameraRollAssetType[]; // "All", "Videos", "Photos"
7485
7486 /**
7487 * Saves the image to the camera roll / gallery.
7488 *
7489 * @tag On Android, this is a local URI, such as "file:///sdcard/img.png".
7490 * On iOS, the tag can be one of the following:
7491 * local URI
7492 * assets-library tag
7493 * a tag not matching any of the above, which means the image data will be stored in memory (and consume memory as long as the process is alive)
7494 *
7495 * @deprecated use saveToCameraRoll instead
7496 */
7497 saveImageWithTag(tag: string): Promise<string>;
7498
7499 /**
7500 * Saves the photo or video to the camera roll / gallery.
7501 *
7502 * On Android, the tag must be a local image or video URI, such as `"file:///sdcard/img.png"`.
7503 *
7504 * On iOS, the tag can be any image URI (including local, remote asset-library and base64 data URIs)
7505 * or a local video file URI (remote or data URIs are not supported for saving video at this time).
7506 *
7507 * If the tag has a file extension of .mov or .mp4, it will be inferred as a video. Otherwise
7508 * it will be treated as a photo. To override the automatic choice, you can pass an optional
7509 * `type` parameter that must be one of 'photo' or 'video'.
7510 *
7511 * Returns a Promise which will resolve with the new URI.
7512 */
7513 saveToCameraRoll(tag: string, type?: 'photo' | 'video'): Promise<string>;
7514
7515 /**
7516 * Invokes callback with photo identifier objects from the local camera roll of the device matching shape defined by getPhotosReturnChecker.
7517 *
7518 * @param params See getPhotosParamChecker.
7519 */
7520 getPhotos(params: GetPhotosParamType): Promise<GetPhotosReturnType>;
7521}
7522
7523/** Clipboard gives you an interface for setting and getting content from Clipboard on both iOS and Android */
7524export interface ClipboardStatic {
7525 getString(): Promise<string>;
7526 setString(content: string): void;
7527}
7528
7529export interface DatePickerAndroidOpenOptions {
7530 date?: Date | number | undefined;
7531 minDate?: Date | number | undefined;
7532 maxDate?: Date | number | undefined;
7533 mode?: 'calendar' | 'spinner' | 'default' | undefined;
7534}
7535
7536// Deduced from DatePickerAndroid.android.js
7537export interface DatePickerAndroidDateSetAction {
7538 action: 'dateSetAction';
7539 year: number;
7540 month: number;
7541 day: number;
7542}
7543
7544export interface DatePickerAndroidDismissedAction {
7545 action: 'dismissedAction';
7546}
7547
7548export type DatePickerAndroidOpenReturn = DatePickerAndroidDateSetAction | DatePickerAndroidDismissedAction;
7549
7550export interface DatePickerAndroidStatic {
7551 /**
7552 * Opens the standard Android date picker dialog.
7553 *
7554 * The available keys for the options object are:
7555 * - date (Date object or timestamp in milliseconds) - date to show by default
7556 * - minDate (Date or timestamp in milliseconds) - minimum date that can be selected
7557 * - maxDate (Date object or timestamp in milliseconds) - maximum date that can be selected
7558 * - mode (enum('calendar', 'spinner', 'default')) - To set the date-picker mode to calendar/spinner/default
7559 * - 'calendar': Show a date picker in calendar mode.
7560 * - 'spinner': Show a date picker in spinner mode.
7561 * - 'default': Show a default native date picker(spinner/calendar) based on android versions.
7562 *
7563 * Returns a Promise which will be invoked an object containing action, year, month (0-11), day if the user picked a date.
7564 * If the user dismissed the dialog, the Promise will still be resolved with action being DatePickerAndroid.dismissedAction and all the other keys being undefined.
7565 * Always check whether the action before reading the values.
7566 *
7567 * Note the native date picker dialog has some UI glitches on Android 4 and lower when using the minDate and maxDate options.
7568 */
7569 open(options?: DatePickerAndroidOpenOptions): Promise<DatePickerAndroidOpenReturn>;
7570
7571 /**
7572 * A date has been selected.
7573 */
7574 dateSetAction: 'dateSetAction';
7575
7576 /**
7577 * The dialog has been dismissed.
7578 */
7579 dismissedAction: 'dismissedAction';
7580}
7581
7582export interface LinkingStatic extends NativeEventEmitter {
7583 /**
7584 * Add a handler to Linking changes by listening to the `url` event type
7585 * and providing the handler
7586 */
7587 addEventListener(type: 'url', handler: (event: { url: string }) => void): EmitterSubscription;
7588
7589 /**
7590 * Remove a handler by passing the `url` event type and the handler
7591 * @deprecated Call remove() on the return value of addEventListener() instead.
7592 */
7593 removeEventListener(type: 'url', handler: (event: { url: string }) => void): void;
7594
7595 /**
7596 * Try to open the given url with any of the installed apps.
7597 * You can use other URLs, like a location (e.g. "geo:37.484847,-122.148386"), a contact, or any other URL that can be opened with the installed apps.
7598 * NOTE: This method will fail if the system doesn't know how to open the specified URL. If you're passing in a non-http(s) URL, it's best to check {@code canOpenURL} first.
7599 * NOTE: For web URLs, the protocol ("http://", "https://") must be set accordingly!
7600 */
7601 openURL(url: string): Promise<any>;
7602
7603 /**
7604 * Determine whether or not an installed app can handle a given URL.
7605 * NOTE: For web URLs, the protocol ("http://", "https://") must be set accordingly!
7606 * NOTE: As of iOS 9, your app needs to provide the LSApplicationQueriesSchemes key inside Info.plist.
7607 * @param URL the URL to open
7608 */
7609 canOpenURL(url: string): Promise<boolean>;
7610
7611 /**
7612 * If the app launch was triggered by an app link with, it will give the link url, otherwise it will give null
7613 * NOTE: To support deep linking on Android, refer http://developer.android.com/training/app-indexing/deep-linking.html#handling-intents
7614 */
7615 getInitialURL(): Promise<string | null>;
7616
7617 /**
7618 * Open the Settings app and displays the app’s custom settings, if it has any.
7619 */
7620 openSettings(): Promise<void>;
7621
7622 /**
7623 * Sends an Android Intent - a broad surface to express Android functions. Useful for deep-linking to settings pages,
7624 * opening an SMS app with a message draft in place, and more. See https://developer.android.com/reference/kotlin/android/content/Intent?hl=en
7625 */
7626 sendIntent(action: string, extras?: Array<{ key: string; value: string | number | boolean }>): Promise<void>;
7627}
7628
7629export interface LogBoxStatic {
7630 /**
7631 * Silence any logs that match the given strings or regexes.
7632 */
7633 ignoreLogs(patterns: (string | RegExp)[]): void;
7634
7635 /**
7636 * Toggle error and warning notifications
7637 * Note: this only disables notifications, uncaught errors will still open a full screen LogBox.
7638 * @param ignore whether to ignore logs or not
7639 */
7640 ignoreAllLogs(ignore?: boolean): void;
7641
7642 install(): void;
7643 uninstall(): void;
7644}
7645
7646export interface PanResponderGestureState {
7647 /**
7648 * ID of the gestureState- persisted as long as there at least one touch on
7649 */
7650 stateID: number;
7651
7652 /**
7653 * the latest screen coordinates of the recently-moved touch
7654 */
7655 moveX: number;
7656
7657 /**
7658 * the latest screen coordinates of the recently-moved touch
7659 */
7660 moveY: number;
7661
7662 /**
7663 * the screen coordinates of the responder grant
7664 */
7665 x0: number;
7666
7667 /**
7668 * the screen coordinates of the responder grant
7669 */
7670 y0: number;
7671
7672 /**
7673 * accumulated distance of the gesture since the touch started
7674 */
7675 dx: number;
7676
7677 /**
7678 * accumulated distance of the gesture since the touch started
7679 */
7680 dy: number;
7681
7682 /**
7683 * current velocity of the gesture
7684 */
7685 vx: number;
7686
7687 /**
7688 * current velocity of the gesture
7689 */
7690 vy: number;
7691
7692 /**
7693 * Number of touches currently on screen
7694 */
7695 numberActiveTouches: number;
7696
7697 // All `gestureState` accounts for timeStamps up until:
7698 _accountsForMovesUpTo: number;
7699}
7700
7701/**
7702 * @see documentation of GestureResponderHandlers
7703 */
7704export interface PanResponderCallbacks {
7705 onMoveShouldSetPanResponder?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean) | undefined;
7706 onStartShouldSetPanResponder?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean) | undefined;
7707 onPanResponderGrant?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => void) | undefined;
7708 onPanResponderMove?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => void) | undefined;
7709 onPanResponderRelease?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => void) | undefined;
7710 onPanResponderTerminate?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => void) | undefined;
7711
7712 onMoveShouldSetPanResponderCapture?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean) | undefined;
7713 onStartShouldSetPanResponderCapture?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean) | undefined;
7714 onPanResponderReject?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => void) | undefined;
7715 onPanResponderStart?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => void) | undefined;
7716 onPanResponderEnd?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => void) | undefined;
7717 onPanResponderTerminationRequest?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean) | undefined;
7718 onShouldBlockNativeResponder?: ((e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean) | undefined;
7719}
7720
7721export interface PanResponderInstance {
7722 panHandlers: GestureResponderHandlers;
7723}
7724
7725/**
7726 * PanResponder reconciles several touches into a single gesture.
7727 * It makes single-touch gestures resilient to extra touches,
7728 * and can be used to recognize simple multi-touch gestures.
7729 *
7730 * It provides a predictable wrapper of the responder handlers provided by the gesture responder system.
7731 * For each handler, it provides a new gestureState object alongside the normal event.
7732 */
7733export interface PanResponderStatic {
7734 /**
7735 * @param config Enhanced versions of all of the responder callbacks
7736 * that provide not only the typical `ResponderSyntheticEvent`, but also the
7737 * `PanResponder` gesture state. Simply replace the word `Responder` with
7738 * `PanResponder` in each of the typical `onResponder*` callbacks. For
7739 * example, the `config` object would look like:
7740 *
7741 * - `onMoveShouldSetPanResponder: (e, gestureState) => {...}`
7742 * - `onMoveShouldSetPanResponderCapture: (e, gestureState) => {...}`
7743 * - `onStartShouldSetPanResponder: (e, gestureState) => {...}`
7744 * - `onStartShouldSetPanResponderCapture: (e, gestureState) => {...}`
7745 * - `onPanResponderReject: (e, gestureState) => {...}`
7746 * - `onPanResponderGrant: (e, gestureState) => {...}`
7747 * - `onPanResponderStart: (e, gestureState) => {...}`
7748 * - `onPanResponderEnd: (e, gestureState) => {...}`
7749 * - `onPanResponderRelease: (e, gestureState) => {...}`
7750 * - `onPanResponderMove: (e, gestureState) => {...}`
7751 * - `onPanResponderTerminate: (e, gestureState) => {...}`
7752 * - `onPanResponderTerminationRequest: (e, gestureState) => {...}`
7753 * - `onShouldBlockNativeResponder: (e, gestureState) => {...}`
7754 *
7755 * In general, for events that have capture equivalents, we update the
7756 * gestureState once in the capture phase and can use it in the bubble phase
7757 * as well.
7758 *
7759 * Be careful with onStartShould* callbacks. They only reflect updated
7760 * `gestureState` for start/end events that bubble/capture to the Node.
7761 * Once the node is the responder, you can rely on every start/end event
7762 * being processed by the gesture and `gestureState` being updated
7763 * accordingly. (numberActiveTouches) may not be totally accurate unless you
7764 * are the responder.
7765 */
7766 create(config: PanResponderCallbacks): PanResponderInstance;
7767}
7768
7769export interface Rationale {
7770 title: string;
7771 message: string;
7772 buttonPositive: string;
7773 buttonNegative?: string | undefined;
7774 buttonNeutral?: string | undefined;
7775}
7776
7777export type Permission =
7778 | 'android.permission.READ_CALENDAR'
7779 | 'android.permission.WRITE_CALENDAR'
7780 | 'android.permission.CAMERA'
7781 | 'android.permission.READ_CONTACTS'
7782 | 'android.permission.WRITE_CONTACTS'
7783 | 'android.permission.GET_ACCOUNTS'
7784 | 'android.permission.ACCESS_FINE_LOCATION'
7785 | 'android.permission.ACCESS_COARSE_LOCATION'
7786 | 'android.permission.ACCESS_BACKGROUND_LOCATION'
7787 | 'android.permission.RECORD_AUDIO'
7788 | 'android.permission.READ_PHONE_STATE'
7789 | 'android.permission.CALL_PHONE'
7790 | 'android.permission.READ_CALL_LOG'
7791 | 'android.permission.WRITE_CALL_LOG'
7792 | 'com.android.voicemail.permission.ADD_VOICEMAIL'
7793 | 'android.permission.USE_SIP'
7794 | 'android.permission.PROCESS_OUTGOING_CALLS'
7795 | 'android.permission.BODY_SENSORS'
7796 | 'android.permission.SEND_SMS'
7797 | 'android.permission.RECEIVE_SMS'
7798 | 'android.permission.READ_SMS'
7799 | 'android.permission.RECEIVE_WAP_PUSH'
7800 | 'android.permission.RECEIVE_MMS'
7801 | 'android.permission.READ_EXTERNAL_STORAGE'
7802 | 'android.permission.WRITE_EXTERNAL_STORAGE';
7803
7804export type PermissionStatus = 'granted' | 'denied' | 'never_ask_again';
7805
7806export interface PermissionsAndroidStatic {
7807 /**
7808 * A list of permission results that are returned
7809 */
7810 RESULTS: { [key: string]: PermissionStatus };
7811 /**
7812 * A list of specified "dangerous" permissions that require prompting the user
7813 */
7814 PERMISSIONS: { [key: string]: Permission };
7815 new (): PermissionsAndroidStatic;
7816 /**
7817 * @deprecated Use check instead
7818 */
7819 checkPermission(permission: Permission): Promise<boolean>;
7820 /**
7821 * Returns a promise resolving to a boolean value as to whether the specified
7822 * permissions has been granted
7823 */
7824 check(permission: Permission): Promise<boolean>;
7825 /**
7826 * @deprecated Use request instead
7827 */
7828 requestPermission(permission: Permission, rationale?: Rationale): Promise<boolean>;
7829 /**
7830 * Prompts the user to enable a permission and returns a promise resolving to a
7831 * string value indicating whether the user allowed or denied the request
7832 *
7833 * If the optional rationale argument is included (which is an object with a
7834 * title and message), this function checks with the OS whether it is necessary
7835 * to show a dialog explaining why the permission is needed
7836 * (https://developer.android.com/training/permissions/requesting.html#explain)
7837 * and then shows the system permission dialog
7838 */
7839 request(permission: Permission, rationale?: Rationale): Promise<PermissionStatus>;
7840 /**
7841 * Prompts the user to enable multiple permissions in the same dialog and
7842 * returns an object with the permissions as keys and strings as values
7843 * indicating whether the user allowed or denied the request
7844 */
7845 requestMultiple(permissions: Array<Permission>): Promise<{ [key in Permission]: PermissionStatus }>;
7846}
7847
7848export interface PushNotificationPermissions {
7849 alert?: boolean | undefined;
7850 badge?: boolean | undefined;
7851 sound?: boolean | undefined;
7852}
7853
7854export interface PushNotification {
7855 /**
7856 * An alias for `getAlert` to get the notification's main message string
7857 */
7858 getMessage(): string | Object;
7859
7860 /**
7861 * Gets the sound string from the `aps` object
7862 */
7863 getSound(): string;
7864
7865 /**
7866 * Gets the category string from the `aps` object
7867 */
7868 getCategory(): string;
7869
7870 /**
7871 * Gets the notification's main message from the `aps` object
7872 */
7873 getAlert(): string | Object;
7874
7875 /**
7876 * Gets the content-available number from the `aps` object
7877 */
7878 getContentAvailable(): number;
7879
7880 /**
7881 * Gets the badge count number from the `aps` object
7882 */
7883 getBadgeCount(): number;
7884
7885 /**
7886 * Gets the data object on the notif
7887 */
7888 getData(): Object;
7889
7890 /**
7891 * iOS Only
7892 * Signifies remote notification handling is complete
7893 */
7894 finish(result: string): void;
7895}
7896
7897type PresentLocalNotificationDetails = {
7898 alertBody: string;
7899 alertAction: string;
7900 alertTitle?: string | undefined;
7901 soundName?: string | undefined;
7902 category?: string | undefined;
7903 userInfo?: Object | undefined;
7904 applicationIconBadgeNumber?: number | undefined;
7905};
7906
7907type ScheduleLocalNotificationDetails = {
7908 alertAction?: string | undefined;
7909 alertBody?: string | undefined;
7910 alertTitle?: string | undefined;
7911 applicationIconBadgeNumber?: number | undefined;
7912 category?: string | undefined;
7913 fireDate?: number | string | undefined;
7914 isSilent?: boolean | undefined;
7915 repeatInterval?: 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | undefined;
7916 soundName?: string | undefined;
7917 userInfo?: Object | undefined;
7918};
7919
7920export type PushNotificationEventName = 'notification' | 'localNotification' | 'register' | 'registrationError';
7921
7922type FetchResult = {
7923 NewData: 'UIBackgroundFetchResultNewData';
7924 NoData: 'UIBackgroundFetchResultNoData';
7925 ResultFailed: 'UIBackgroundFetchResultFailed';
7926};
7927
7928/**
7929 * Handle push notifications for your app, including permission handling and icon badge number.
7930 * @see https://reactnative.dev/docs/pushnotificationios#content
7931 *
7932 * //FIXME: BGR: The documentation seems completely off compared to the actual js implementation. I could never get the example to run
7933 */
7934export interface PushNotificationIOSStatic {
7935 /**
7936 * Schedules the localNotification for immediate presentation.
7937 * details is an object containing:
7938 * alertBody : The message displayed in the notification alert.
7939 * alertAction : The "action" displayed beneath an actionable notification. Defaults to "view";
7940 * soundName : The sound played when the notification is fired (optional).
7941 * category : The category of this notification, required for actionable notifications (optional).
7942 * userInfo : An optional object containing additional notification data.
7943 * applicationIconBadgeNumber (optional) : The number to display as the app's icon badge. The default value of this property is 0, which means that no badge is displayed.
7944 */
7945 presentLocalNotification(details: PresentLocalNotificationDetails): void;
7946
7947 /**
7948 * Schedules the localNotification for future presentation.
7949 * details is an object containing:
7950 * fireDate : The date and time when the system should deliver the notification.
7951 * alertBody : The message displayed in the notification alert.
7952 * alertAction : The "action" displayed beneath an actionable notification. Defaults to "view";
7953 * soundName : The sound played when the notification is fired (optional).
7954 * category : The category of this notification, required for actionable notifications (optional).
7955 * userInfo : An optional object containing additional notification data.
7956 * applicationIconBadgeNumber (optional) : The number to display as the app's icon badge. Setting the number to 0 removes the icon badge.
7957 */
7958 scheduleLocalNotification(details: ScheduleLocalNotificationDetails): void;
7959
7960 /**
7961 * Cancels all scheduled localNotifications
7962 */
7963 cancelAllLocalNotifications(): void;
7964
7965 /**
7966 * Cancel local notifications.
7967 * Optionally restricts the set of canceled notifications to those notifications whose userInfo fields match the corresponding fields in the userInfo argument.
7968 */
7969 cancelLocalNotifications(userInfo: Object): void;
7970
7971 /**
7972 * Sets the badge number for the app icon on the home screen
7973 */
7974 setApplicationIconBadgeNumber(number: number): void;
7975
7976 /**
7977 * Gets the current badge number for the app icon on the home screen
7978 */
7979 getApplicationIconBadgeNumber(callback: (badge: number) => void): void;
7980
7981 /**
7982 * Gets the local notifications that are currently scheduled.
7983 */
7984 getScheduledLocalNotifications(callback: (notifications: ScheduleLocalNotificationDetails[]) => void): void;
7985
7986 /**
7987 * Attaches a listener to remote notifications while the app is running in the
7988 * foreground or the background.
7989 *
7990 * The handler will get be invoked with an instance of `PushNotificationIOS`
7991 *
7992 * The type MUST be 'notification'
7993 */
7994 addEventListener(
7995 type: 'notification' | 'localNotification',
7996 handler: (notification: PushNotification) => void,
7997 ): void;
7998
7999 /**
8000 * Fired when the user registers for remote notifications.
8001 *
8002 * The handler will be invoked with a hex string representing the deviceToken.
8003 *
8004 * The type MUST be 'register'
8005 */
8006 addEventListener(type: 'register', handler: (deviceToken: string) => void): void;
8007
8008 /**
8009 * Fired when the user fails to register for remote notifications.
8010 * Typically occurs when APNS is having issues, or the device is a simulator.
8011 *
8012 * The handler will be invoked with {message: string, code: number, details: any}.
8013 *
8014 * The type MUST be 'registrationError'
8015 */
8016 addEventListener(
8017 type: 'registrationError',
8018 handler: (error: { message: string; code: number; details: any }) => void,
8019 ): void;
8020
8021 /**
8022 * Removes the event listener. Do this in `componentWillUnmount` to prevent
8023 * memory leaks
8024 */
8025 removeEventListener(
8026 type: PushNotificationEventName,
8027 handler:
8028 | ((notification: PushNotification) => void)
8029 | ((deviceToken: string) => void)
8030 | ((error: { message: string; code: number; details: any }) => void),
8031 ): void;
8032
8033 /**
8034 * Requests all notification permissions from iOS, prompting the user's
8035 * dialog box.
8036 */
8037 requestPermissions(permissions?: PushNotificationPermissions[]): void;
8038
8039 /**
8040 * Requests all notification permissions from iOS, prompting the user's
8041 * dialog box.
8042 */
8043 requestPermissions(permissions?: PushNotificationPermissions): Promise<PushNotificationPermissions>;
8044
8045 /**
8046 * Unregister for all remote notifications received via Apple Push
8047 * Notification service.
8048 * You should call this method in rare circumstances only, such as when
8049 * a new version of the app removes support for all types of remote
8050 * notifications. Users can temporarily prevent apps from receiving
8051 * remote notifications through the Notifications section of the
8052 * Settings app. Apps unregistered through this method can always
8053 * re-register.
8054 */
8055 abandonPermissions(): void;
8056
8057 /**
8058 * See what push permissions are currently enabled. `callback` will be
8059 * invoked with a `permissions` object:
8060 *
8061 * - `alert` :boolean
8062 * - `badge` :boolean
8063 * - `sound` :boolean
8064 */
8065 checkPermissions(callback: (permissions: PushNotificationPermissions) => void): void;
8066
8067 /**
8068 * This method returns a promise that resolves to either the notification
8069 * object if the app was launched by a push notification, or `null` otherwise.
8070 */
8071 getInitialNotification(): Promise<PushNotification | null>;
8072
8073 /**
8074 * iOS fetch results that best describe the result of a finished remote notification handler.
8075 * For a list of possible values, see `PushNotificationIOS.FetchResult`.
8076 */
8077 FetchResult: FetchResult;
8078}
8079
8080export interface SettingsStatic {
8081 get(key: string): any;
8082 set(settings: Object): void;
8083 watchKeys(keys: string | Array<string>, callback: () => void): number;
8084 clearWatch(watchId: number): void;
8085}
8086
8087export type StatusBarStyle = 'default' | 'light-content' | 'dark-content';
8088
8089export type StatusBarAnimation = 'none' | 'fade' | 'slide';
8090
8091export interface StatusBarPropsIOS {
8092 /**
8093 * If the network activity indicator should be visible.
8094 *
8095 * @platform ios
8096 */
8097 networkActivityIndicatorVisible?: boolean | undefined;
8098
8099 /**
8100 * The transition effect when showing and hiding the status bar using
8101 * the hidden prop. Defaults to 'fade'.
8102 *
8103 * @platform ios
8104 */
8105 showHideTransition?: null | 'fade' | 'slide' | 'none' | undefined;
8106}
8107
8108export interface StatusBarPropsAndroid {
8109 /**
8110 * The background color of the status bar.
8111 *
8112 * @platform android
8113 */
8114 backgroundColor?: ColorValue | undefined;
8115
8116 /**
8117 * If the status bar is translucent. When translucent is set to true,
8118 * the app will draw under the status bar. This is useful when using a
8119 * semi transparent status bar color.
8120 *
8121 * @platform android
8122 */
8123 translucent?: boolean | undefined;
8124}
8125
8126export interface StatusBarProps extends StatusBarPropsIOS, StatusBarPropsAndroid {
8127 /**
8128 * If the transition between status bar property changes should be
8129 * animated. Supported for backgroundColor, barStyle and hidden.
8130 */
8131 animated?: boolean | undefined;
8132
8133 /**
8134 * Sets the color of the status bar text.
8135 */
8136 barStyle?: null | StatusBarStyle | undefined;
8137
8138 /**
8139 * If the status bar is hidden.
8140 */
8141 hidden?: boolean | undefined;
8142}
8143
8144export class StatusBar extends React.Component<StatusBarProps> {
8145 /**
8146 * The current height of the status bar on the device.
8147 * @platform android
8148 */
8149 static currentHeight?: number | undefined;
8150
8151 /**
8152 * Show or hide the status bar
8153 * @param hidden The dialog's title.
8154 * @param animation Optional animation when
8155 * changing the status bar hidden property.
8156 */
8157 static setHidden: (hidden: boolean, animation?: StatusBarAnimation) => void;
8158
8159 /**
8160 * Set the status bar style
8161 * @param style Status bar style to set
8162 * @param animated Animate the style change.
8163 */
8164 static setBarStyle: (style: StatusBarStyle, animated?: boolean) => void;
8165
8166 /**
8167 * Control the visibility of the network activity indicator
8168 * @param visible Show the indicator.
8169 */
8170 static setNetworkActivityIndicatorVisible: (visible: boolean) => void;
8171
8172 /**
8173 * Set the background color for the status bar
8174 * @param color Background color.
8175 * @param animated Animate the style change.
8176 */
8177 static setBackgroundColor: (color: ColorValue, animated?: boolean) => void;
8178
8179 /**
8180 * Control the translucency of the status bar
8181 * @param translucent Set as translucent.
8182 */
8183 static setTranslucent: (translucent: boolean) => void;
8184
8185 /**
8186 * Push a StatusBar entry onto the stack.
8187 * The return value should be passed to `popStackEntry` when complete.
8188 *
8189 * @param props Object containing the StatusBar props to use in the stack entry.
8190 */
8191 static pushStackEntry: (props: StatusBarProps) => StatusBarProps;
8192
8193 /**
8194 * Pop a StatusBar entry from the stack.
8195 *
8196 * @param entry Entry returned from `pushStackEntry`.
8197 */
8198 static popStackEntry: (entry: StatusBarProps) => void;
8199
8200 /**
8201 * Replace an existing StatusBar stack entry with new props.
8202 *
8203 * @param entry Entry returned from `pushStackEntry` to replace.
8204 * @param props Object containing the StatusBar props to use in the replacement stack entry.
8205 */
8206 static replaceStackEntry: (entry: StatusBarProps, props: StatusBarProps) => StatusBarProps;
8207}
8208
8209export interface TimePickerAndroidOpenOptions {
8210 hour?: number | undefined;
8211 minute?: number | undefined;
8212 is24Hour?: boolean | undefined;
8213 mode?: 'clock' | 'spinner' | 'default' | undefined;
8214}
8215
8216export interface TimePickerAndroidTimeSetAction {
8217 action: 'timeSetAction';
8218 hour: number;
8219 minute: number;
8220}
8221
8222export interface TimePickerAndroidDismissedAction {
8223 action: 'dismissedAction';
8224}
8225
8226export type TimePickerAndroidOpenReturn = TimePickerAndroidTimeSetAction | TimePickerAndroidDismissedAction;
8227
8228/**
8229 * Opens the standard Android time picker dialog.
8230 *
8231 * ### Example
8232 *
8233 * ```
8234 * try {
8235 * const {action, hour, minute} = await TimePickerAndroid.open({
8236 * hour: 14,
8237 * minute: 0,
8238 * is24Hour: false, // Will display '2 PM'
8239 * });
8240 * if (action !== TimePickerAndroid.dismissedAction) {
8241 * // Selected hour (0-23), minute (0-59)
8242 * }
8243 * } catch ({code, message}) {
8244 * console.warn('Cannot open time picker', message);
8245 * }
8246 * ```
8247 */
8248export interface TimePickerAndroidStatic {
8249 /**
8250 * Opens the standard Android time picker dialog.
8251 *
8252 * The available keys for the `options` object are:
8253 * * `hour` (0-23) - the hour to show, defaults to the current time
8254 * * `minute` (0-59) - the minute to show, defaults to the current time
8255 * * `is24Hour` (boolean) - If `true`, the picker uses the 24-hour format. If `false`,
8256 * the picker shows an AM/PM chooser. If undefined, the default for the current locale
8257 * is used.
8258 * * `mode` (enum('clock', 'spinner', 'default')) - set the time picker mode
8259 * * 'clock': Show a time picker in clock mode.
8260 * * 'spinner': Show a time picker in spinner mode.
8261 * * 'default': Show a default time picker based on Android versions.
8262 *
8263 * Returns a Promise which will be invoked an object containing `action`, `hour` (0-23),
8264 * `minute` (0-59) if the user picked a time. If the user dismissed the dialog, the Promise will
8265 * still be resolved with action being `TimePickerAndroid.dismissedAction` and all the other keys
8266 * being undefined. **Always** check whether the `action` before reading the values.
8267 */
8268 open(options: TimePickerAndroidOpenOptions): Promise<TimePickerAndroidOpenReturn>;
8269
8270 /**
8271 * A time has been selected.
8272 */
8273 timeSetAction: 'timeSetAction';
8274
8275 /**
8276 * The dialog has been dismissed.
8277 */
8278 dismissedAction: 'dismissedAction';
8279}
8280
8281/**
8282 * This exposes the native ToastAndroid module as a JS module. This has a function 'show'
8283 * which takes the following parameters:
8284 *
8285 * 1. String message: A string with the text to toast
8286 * 2. int duration: The duration of the toast. May be ToastAndroid.SHORT or ToastAndroid.LONG
8287 *
8288 * There is also a function `showWithGravity` to specify the layout gravity. May be
8289 * ToastAndroid.TOP, ToastAndroid.BOTTOM, ToastAndroid.CENTER
8290 */
8291export interface ToastAndroidStatic {
8292 /**
8293 * String message: A string with the text to toast
8294 * int duration: The duration of the toast.
8295 * May be ToastAndroid.SHORT or ToastAndroid.LONG
8296 */
8297 show(message: string, duration: number): void;
8298 /** `gravity` may be ToastAndroid.TOP, ToastAndroid.BOTTOM, ToastAndroid.CENTER */
8299 showWithGravity(message: string, duration: number, gravity: number): void;
8300
8301 showWithGravityAndOffset(
8302 message: string,
8303 duration: number,
8304 gravity: number,
8305 xOffset: number,
8306 yOffset: number,
8307 ): void;
8308 // Toast duration constants
8309 SHORT: number;
8310 LONG: number;
8311 // Toast gravity constants
8312 TOP: number;
8313 BOTTOM: number;
8314 CENTER: number;
8315}
8316
8317export interface UIManagerStatic {
8318 /**
8319 * Capture an image of the screen, window or an individual view. The image
8320 * will be stored in a temporary file that will only exist for as long as the
8321 * app is running.
8322 *
8323 * The `view` argument can be the literal string `window` if you want to
8324 * capture the entire window, or it can be a reference to a specific
8325 * React Native component.
8326 *
8327 * The `options` argument may include:
8328 * - width/height (number) - the width and height of the image to capture.
8329 * - format (string) - either 'png' or 'jpeg'. Defaults to 'png'.
8330 * - quality (number) - the quality when using jpeg. 0.0 - 1.0 (default).
8331 *
8332 * Returns a Promise<string> (tempFilePath)
8333 * @platform ios
8334 */
8335 takeSnapshot: (
8336 view?: 'window' | React.ReactElement | number,
8337 options?: {
8338 width?: number | undefined;
8339 height?: number | undefined;
8340 format?: 'png' | 'jpeg' | undefined;
8341 quality?: number | undefined;
8342 },
8343 ) => Promise<string>;
8344
8345 /**
8346 * Determines the location on screen, width, and height of the given view and
8347 * returns the values via an async callback. If successful, the callback will
8348 * be called with the following arguments:
8349 *
8350 * - x
8351 * - y
8352 * - width
8353 * - height
8354 * - pageX
8355 * - pageY
8356 *
8357 * Note that these measurements are not available until after the rendering
8358 * has been completed in native. If you need the measurements as soon as
8359 * possible, consider using the [`onLayout`
8360 * prop](docs/view.html#onlayout) instead.
8361 *
8362 * @deprecated Use `ref.measure` instead.
8363 */
8364 measure(node: number, callback: MeasureOnSuccessCallback): void;
8365
8366 /**
8367 * Determines the location of the given view in the window and returns the
8368 * values via an async callback. If the React root view is embedded in
8369 * another native view, this will give you the absolute coordinates. If
8370 * successful, the callback will be called with the following
8371 * arguments:
8372 *
8373 * - x
8374 * - y
8375 * - width
8376 * - height
8377 *
8378 * Note that these measurements are not available until after the rendering
8379 * has been completed in native.
8380 *
8381 * @deprecated Use `ref.measureInWindow` instead.
8382 */
8383 measureInWindow(node: number, callback: MeasureInWindowOnSuccessCallback): void;
8384
8385 /**
8386 * Like [`measure()`](#measure), but measures the view relative an ancestor,
8387 * specified as `relativeToNativeNode`. This means that the returned x, y
8388 * are relative to the origin x, y of the ancestor view.
8389 *
8390 * As always, to obtain a native node handle for a component, you can use
8391 * `React.findNodeHandle(component)`.
8392 *
8393 * @deprecated Use `ref.measureLayout` instead.
8394 */
8395 measureLayout(
8396 node: number,
8397 relativeToNativeNode: number,
8398 onFail: () => void /* currently unused */,
8399 onSuccess: MeasureLayoutOnSuccessCallback,
8400 ): void;
8401
8402 /**
8403 * Automatically animates views to their new positions when the
8404 * next layout happens.
8405 *
8406 * A common way to use this API is to call it before calling `setState`.
8407 *
8408 * Note that in order to get this to work on **Android** you need to set the following flags via `UIManager`:
8409 *
8410 * UIManager.setLayoutAnimationEnabledExperimental && UIManager.setLayoutAnimationEnabledExperimental(true);
8411 */
8412 setLayoutAnimationEnabledExperimental(value: boolean): void;
8413
8414 /**
8415 * Used to display an Android PopupMenu. If a menu item is pressed, the success callback will
8416 * be called with the following arguments:
8417 *
8418 * - item - the menu item.
8419 * - index - index of the pressed item in array. Returns `undefined` if cancelled.
8420 *
8421 * To obtain a native node handle for a component, you can use
8422 * `React.findNodeHandle(component)`.
8423 *
8424 * Note that this works only on Android
8425 */
8426 showPopupMenu(
8427 node: number,
8428 items: string[],
8429 error: () => void /* currently unused */,
8430 success: (item: string, index: number | undefined) => void,
8431 ): void;
8432
8433 getViewManagerConfig: (
8434 name: string,
8435 ) => {
8436 Commands: { [key: string]: number };
8437 };
8438
8439 hasViewManagerConfig: (name: string) => boolean;
8440
8441 /**
8442 * Used to call a native view method from JavaScript
8443 *
8444 * reactTag - Id of react view.
8445 * commandID - Id of the native method that should be called.
8446 * commandArgs - Args of the native method that we can pass from JS to native.
8447 */
8448 dispatchViewManagerCommand: (reactTag: number | null, commandID: number | string, commandArgs?: Array<any>) => void;
8449}
8450
8451export interface SwitchPropsIOS extends ViewProps {
8452 /**
8453 * Background color when the switch is turned on.
8454 *
8455 * @deprecated use trackColor instead
8456 */
8457 onTintColor?: ColorValue | undefined;
8458
8459 /**
8460 * Color of the foreground switch grip.
8461 *
8462 * @deprecated use thumbColor instead
8463 */
8464 thumbTintColor?: ColorValue | undefined;
8465
8466 /**
8467 * Background color when the switch is turned off.
8468 *
8469 * @deprecated use trackColor instead
8470 */
8471 tintColor?: ColorValue | undefined;
8472}
8473
8474export interface SwitchChangeEvent extends React.SyntheticEvent {
8475 value: boolean;
8476}
8477
8478export interface SwitchProps extends SwitchPropsIOS {
8479 /**
8480 * Color of the foreground switch grip.
8481 */
8482 thumbColor?: ColorValue | undefined;
8483
8484 /**
8485 * Custom colors for the switch track
8486 *
8487 * Color when false and color when true
8488 */
8489 trackColor?: { false?: ColorValue | null | undefined; true?: ColorValue | null | undefined } | undefined;
8490
8491 /**
8492 * If true the user won't be able to toggle the switch.
8493 * Default value is false.
8494 */
8495 disabled?: boolean | undefined;
8496
8497 /**
8498 * Invoked with the the change event as an argument when the value changes.
8499 */
8500 onChange?: ((event: SwitchChangeEvent) => Promise<void> | void) | null | undefined;
8501
8502 /**
8503 * Invoked with the new value when the value changes.
8504 */
8505 onValueChange?: ((value: boolean) => Promise<void> | void) | null | undefined;
8506
8507 /**
8508 * Used to locate this view in end-to-end tests.
8509 */
8510 testID?: string | undefined;
8511
8512 /**
8513 * The value of the switch. If true the switch will be turned on.
8514 * Default value is false.
8515 */
8516 value?: boolean | undefined;
8517
8518 /**
8519 * On iOS, custom color for the background.
8520 * Can be seen when the switch value is false or when the switch is disabled.
8521 */
8522 ios_backgroundColor?: ColorValue | undefined;
8523
8524 style?: StyleProp<ViewStyle> | undefined;
8525}
8526
8527/**
8528 * Renders a boolean input.
8529 *
8530 * This is a controlled component that requires an `onValueChange` callback that
8531 * updates the `value` prop in order for the component to reflect user actions.
8532 * If the `value` prop is not updated, the component will continue to render
8533 * the supplied `value` prop instead of the expected result of any user actions.
8534 */
8535declare class SwitchComponent extends React.Component<SwitchProps> {}
8536declare const SwitchBase: Constructor<NativeMethods> & typeof SwitchComponent;
8537export class Switch extends SwitchBase {}
8538
8539/**
8540 * The Vibration API is exposed at `Vibration.vibrate()`.
8541 * The vibration is asynchronous so this method will return immediately.
8542 *
8543 * There will be no effect on devices that do not support Vibration, eg. the simulator.
8544 *
8545 * **Note for android**
8546 * add `<uses-permission android:name="android.permission.VIBRATE"/>` to `AndroidManifest.xml`
8547 *
8548 * **Android Usage:**
8549 *
8550 * [0, 500, 200, 500]
8551 * V(0.5s) --wait(0.2s)--> V(0.5s)
8552 *
8553 * [300, 500, 200, 500]
8554 * --wait(0.3s)--> V(0.5s) --wait(0.2s)--> V(0.5s)
8555 *
8556 * **iOS Usage:**
8557 * if first argument is 0, it will not be included in pattern array.
8558 *
8559 * [0, 1000, 2000, 3000]
8560 * V(fixed) --wait(1s)--> V(fixed) --wait(2s)--> V(fixed) --wait(3s)--> V(fixed)
8561 */
8562export interface VibrationStatic {
8563 vibrate(pattern?: number | number[] | null, repeat?: boolean | null): void;
8564
8565 /**
8566 * Stop vibration
8567 */
8568 cancel(): void;
8569}
8570
8571type ColorSchemeName = 'light' | 'dark' | null | undefined;
8572
8573export namespace Appearance {
8574 type AppearancePreferences = {
8575 colorScheme: ColorSchemeName;
8576 };
8577
8578 type AppearanceListener = (preferences: AppearancePreferences) => void;
8579
8580 /**
8581 * Note: Although color scheme is available immediately, it may change at any
8582 * time. Any rendering logic or styles that depend on this should try to call
8583 * this function on every render, rather than caching the value (for example,
8584 * using inline styles rather than setting a value in a `StyleSheet`).
8585 *
8586 * Example: `const colorScheme = Appearance.getColorScheme();`
8587 */
8588 export function getColorScheme(): ColorSchemeName;
8589
8590 /**
8591 * Add an event handler that is fired when appearance preferences change.
8592 */
8593 export function addChangeListener(listener: AppearanceListener): NativeEventSubscription;
8594
8595 /**
8596 * @deprecated Use the `remove()` method on the event subscription returned by `addEventListener()`.
8597 *
8598 * Remove a handler by passing the change event type and the handler.
8599 */
8600 export function removeChangeListener(listener: AppearanceListener): void;
8601}
8602
8603/**
8604 * A new useColorScheme hook is provided as the preferred way of accessing
8605 * the user's preferred color scheme (aka Dark Mode).
8606 */
8607export function useColorScheme(): ColorSchemeName;
8608
8609/**
8610 * This class implements common easing functions. The math is pretty obscure,
8611 * but this cool website has nice visual illustrations of what they represent:
8612 * http://xaedes.de/dev/transitions/
8613 */
8614export type EasingFunction = (value: number) => number;
8615export interface EasingStatic {
8616 step0: EasingFunction;
8617 step1: EasingFunction;
8618 linear: EasingFunction;
8619 ease: EasingFunction;
8620 quad: EasingFunction;
8621 cubic: EasingFunction;
8622 poly(n: number): EasingFunction;
8623 sin: EasingFunction;
8624 circle: EasingFunction;
8625 exp: EasingFunction;
8626 elastic(bounciness: number): EasingFunction;
8627 back(s: number): EasingFunction;
8628 bounce: EasingFunction;
8629 bezier(x1: number, y1: number, x2: number, y2: number): EasingFunction;
8630 in(easing: EasingFunction): EasingFunction;
8631 out(easing: EasingFunction): EasingFunction;
8632 inOut(easing: EasingFunction): EasingFunction;
8633}
8634
8635// We need to alias these views so we can reference them in the Animated
8636// namespace where their names are shadowed.
8637declare const _View: typeof View;
8638declare const _Image: typeof Image;
8639declare const _Text: typeof Text;
8640declare const _ScrollView: typeof ScrollView;
8641export namespace Animated {
8642 type AnimatedValue = Value;
8643 type AnimatedValueXY = ValueXY;
8644
8645 class Animated {
8646 // Internal class, no public API.
8647 }
8648
8649 class AnimatedNode {
8650 /**
8651 * Adds an asynchronous listener to the value so you can observe updates from
8652 * animations. This is useful because there is no way to
8653 * synchronously read the value because it might be driven natively.
8654 *
8655 * See https://reactnative.dev/docs/animatedvalue.html#addlistener
8656 */
8657 addListener(callback: (value: any) => any): string;
8658 /**
8659 * Unregister a listener. The `id` param shall match the identifier
8660 * previously returned by `addListener()`.
8661 *
8662 * See https://reactnative.dev/docs/animatedvalue.html#removelistener
8663 */
8664 removeListener(id: string): void;
8665 /**
8666 * Remove all registered listeners.
8667 *
8668 * See https://reactnative.dev/docs/animatedvalue.html#removealllisteners
8669 */
8670 removeAllListeners(): void;
8671
8672 hasListeners(): boolean;
8673 }
8674
8675 class AnimatedWithChildren extends AnimatedNode {
8676 // Internal class, no public API.
8677 }
8678
8679 class AnimatedInterpolation extends AnimatedWithChildren {
8680 interpolate(config: InterpolationConfigType): AnimatedInterpolation;
8681 }
8682
8683 type ExtrapolateType = 'extend' | 'identity' | 'clamp';
8684
8685 type InterpolationConfigType = {
8686 inputRange: number[];
8687 outputRange: number[] | string[];
8688 easing?: ((input: number) => number) | undefined;
8689 extrapolate?: ExtrapolateType | undefined;
8690 extrapolateLeft?: ExtrapolateType | undefined;
8691 extrapolateRight?: ExtrapolateType | undefined;
8692 };
8693
8694 type ValueListenerCallback = (state: { value: number }) => void;
8695
8696 /**
8697 * Standard value for driving animations. One `Animated.Value` can drive
8698 * multiple properties in a synchronized fashion, but can only be driven by one
8699 * mechanism at a time. Using a new mechanism (e.g. starting a new animation,
8700 * or calling `setValue`) will stop any previous ones.
8701 */
8702 export class Value extends AnimatedWithChildren {
8703 constructor(value: number);
8704
8705 /**
8706 * Directly set the value. This will stop any animations running on the value
8707 * and update all the bound properties.
8708 */
8709 setValue(value: number): void;
8710
8711 /**
8712 * Sets an offset that is applied on top of whatever value is set, whether via
8713 * `setValue`, an animation, or `Animated.event`. Useful for compensating
8714 * things like the start of a pan gesture.
8715 */
8716 setOffset(offset: number): void;
8717
8718 /**
8719 * Merges the offset value into the base value and resets the offset to zero.
8720 * The final output of the value is unchanged.
8721 */
8722 flattenOffset(): void;
8723
8724 /**
8725 * Sets the offset value to the base value, and resets the base value to zero.
8726 * The final output of the value is unchanged.
8727 */
8728 extractOffset(): void;
8729
8730 /**
8731 * Adds an asynchronous listener to the value so you can observe updates from
8732 * animations. This is useful because there is no way to
8733 * synchronously read the value because it might be driven natively.
8734 */
8735 addListener(callback: ValueListenerCallback): string;
8736
8737 removeListener(id: string): void;
8738
8739 removeAllListeners(): void;
8740
8741 /**
8742 * Stops any running animation or tracking. `callback` is invoked with the
8743 * final value after stopping the animation, which is useful for updating
8744 * state to match the animation position with layout.
8745 */
8746 stopAnimation(callback?: (value: number) => void): void;
8747
8748 /**
8749 * Interpolates the value before updating the property, e.g. mapping 0-1 to
8750 * 0-10.
8751 */
8752 interpolate(config: InterpolationConfigType): AnimatedInterpolation;
8753 }
8754
8755 type ValueXYListenerCallback = (value: { x: number; y: number }) => void;
8756
8757 /**
8758 * 2D Value for driving 2D animations, such as pan gestures. Almost identical
8759 * API to normal `Animated.Value`, but multiplexed. Contains two regular
8760 * `Animated.Value`s under the hood.
8761 */
8762 export class ValueXY extends AnimatedWithChildren {
8763 x: AnimatedValue;
8764 y: AnimatedValue;
8765
8766 constructor(valueIn?: { x: number | AnimatedValue; y: number | AnimatedValue });
8767
8768 setValue(value: { x: number; y: number }): void;
8769
8770 setOffset(offset: { x: number; y: number }): void;
8771
8772 flattenOffset(): void;
8773
8774 extractOffset(): void;
8775
8776 stopAnimation(callback?: (value: { x: number; y: number }) => void): void;
8777
8778 addListener(callback: ValueXYListenerCallback): string;
8779
8780 removeListener(id: string): void;
8781
8782 /**
8783 * Converts `{x, y}` into `{left, top}` for use in style, e.g.
8784 *
8785 *```javascript
8786 * style={this.state.anim.getLayout()}
8787 *```
8788 */
8789 getLayout(): { [key: string]: AnimatedValue };
8790
8791 /**
8792 * Converts `{x, y}` into a useable translation transform, e.g.
8793 *
8794 *```javascript
8795 * style={{
8796 * transform: this.state.anim.getTranslateTransform()
8797 * }}
8798 *```
8799 */
8800 getTranslateTransform(): [{ translateX: AnimatedValue }, { translateY: AnimatedValue }];
8801 }
8802
8803 type EndResult = { finished: boolean };
8804 type EndCallback = (result: EndResult) => void;
8805
8806 export interface CompositeAnimation {
8807 /**
8808 * Animations are started by calling start() on your animation.
8809 * start() takes a completion callback that will be called when the
8810 * animation is done or when the animation is done because stop() was
8811 * called on it before it could finish.
8812 *
8813 * @param callback - Optional function that will be called
8814 * after the animation finished running normally or when the animation
8815 * is done because stop() was called on it before it could finish
8816 *
8817 * @example
8818 * Animated.timing({}).start(({ finished }) => {
8819 * // completion callback
8820 * });
8821 */
8822 start: (callback?: EndCallback) => void;
8823 /**
8824 * Stops any running animation.
8825 */
8826 stop: () => void;
8827 /**
8828 * Stops any running animation and resets the value to its original.
8829 */
8830 reset: () => void;
8831 }
8832
8833 interface AnimationConfig {
8834 isInteraction?: boolean | undefined;
8835 useNativeDriver: boolean;
8836 }
8837
8838 /**
8839 * Animates a value from an initial velocity to zero based on a decay
8840 * coefficient.
8841 */
8842 export function decay(value: AnimatedValue | AnimatedValueXY, config: DecayAnimationConfig): CompositeAnimation;
8843
8844 interface DecayAnimationConfig extends AnimationConfig {
8845 velocity: number | { x: number; y: number };
8846 deceleration?: number | undefined;
8847 }
8848
8849 /**
8850 * Animates a value along a timed easing curve. The `Easing` module has tons
8851 * of pre-defined curves, or you can use your own function.
8852 */
8853 export const timing: (value: AnimatedValue | AnimatedValueXY, config: TimingAnimationConfig) => CompositeAnimation;
8854
8855 interface TimingAnimationConfig extends AnimationConfig {
8856 toValue: number | AnimatedValue | { x: number; y: number } | AnimatedValueXY | AnimatedInterpolation;
8857 easing?: ((value: number) => number) | undefined;
8858 duration?: number | undefined;
8859 delay?: number | undefined;
8860 }
8861
8862 interface SpringAnimationConfig extends AnimationConfig {
8863 toValue: number | AnimatedValue | { x: number; y: number } | AnimatedValueXY;
8864 overshootClamping?: boolean | undefined;
8865 restDisplacementThreshold?: number | undefined;
8866 restSpeedThreshold?: number | undefined;
8867 velocity?: number | { x: number; y: number } | undefined;
8868 bounciness?: number | undefined;
8869 speed?: number | undefined;
8870 tension?: number | undefined;
8871 friction?: number | undefined;
8872 stiffness?: number | undefined;
8873 mass?: number | undefined;
8874 damping?: number | undefined;
8875 delay?: number | undefined;
8876 }
8877
8878 interface LoopAnimationConfig {
8879 iterations?: number | undefined; // default -1 for infinite
8880 /**
8881 * Defaults to `true`
8882 */
8883 resetBeforeIteration?: boolean | undefined;
8884 }
8885
8886 /**
8887 * Creates a new Animated value composed from two Animated values added
8888 * together.
8889 */
8890 export function add(a: Animated, b: Animated): AnimatedAddition;
8891
8892 class AnimatedAddition extends AnimatedInterpolation {}
8893
8894 /**
8895 * Creates a new Animated value composed by subtracting the second Animated
8896 * value from the first Animated value.
8897 */
8898 export function subtract(a: Animated, b: Animated): AnimatedSubtraction;
8899
8900 class AnimatedSubtraction extends AnimatedInterpolation {}
8901
8902 /**
8903 * Creates a new Animated value composed by dividing the first Animated
8904 * value by the second Animated value.
8905 */
8906 export function divide(a: Animated, b: Animated): AnimatedDivision;
8907
8908 class AnimatedDivision extends AnimatedInterpolation {}
8909
8910 /**
8911 * Creates a new Animated value composed from two Animated values multiplied
8912 * together.
8913 */
8914 export function multiply(a: Animated, b: Animated): AnimatedMultiplication;
8915
8916 class AnimatedMultiplication extends AnimatedInterpolation {}
8917
8918 /**
8919 * Creates a new Animated value that is the (non-negative) modulo of the
8920 * provided Animated value
8921 */
8922 export function modulo(a: Animated, modulus: number): AnimatedModulo;
8923
8924 class AnimatedModulo extends AnimatedInterpolation {}
8925
8926 /**
8927 * Create a new Animated value that is limited between 2 values. It uses the
8928 * difference between the last value so even if the value is far from the bounds
8929 * it will start changing when the value starts getting closer again.
8930 * (`value = clamp(value + diff, min, max)`).
8931 *
8932 * This is useful with scroll events, for example, to show the navbar when
8933 * scrolling up and to hide it when scrolling down.
8934 */
8935 export function diffClamp(a: Animated, min: number, max: number): AnimatedDiffClamp;
8936
8937 class AnimatedDiffClamp extends AnimatedInterpolation {}
8938
8939 /**
8940 * Starts an animation after the given delay.
8941 */
8942 export function delay(time: number): CompositeAnimation;
8943
8944 /**
8945 * Starts an array of animations in order, waiting for each to complete
8946 * before starting the next. If the current running animation is stopped, no
8947 * following animations will be started.
8948 */
8949 export function sequence(animations: Array<CompositeAnimation>): CompositeAnimation;
8950
8951 /**
8952 * Array of animations may run in parallel (overlap), but are started in
8953 * sequence with successive delays. Nice for doing trailing effects.
8954 */
8955
8956 export function stagger(time: number, animations: Array<CompositeAnimation>): CompositeAnimation;
8957
8958 /**
8959 * Loops a given animation continuously, so that each time it reaches the end,
8960 * it resets and begins again from the start. Can specify number of times to
8961 * loop using the key 'iterations' in the config. Will loop without blocking
8962 * the UI thread if the child animation is set to 'useNativeDriver'.
8963 */
8964
8965 export function loop(animation: CompositeAnimation, config?: LoopAnimationConfig): CompositeAnimation;
8966
8967 /**
8968 * Spring animation based on Rebound and Origami. Tracks velocity state to
8969 * create fluid motions as the `toValue` updates, and can be chained together.
8970 */
8971 export function spring(value: AnimatedValue | AnimatedValueXY, config: SpringAnimationConfig): CompositeAnimation;
8972
8973 type ParallelConfig = {
8974 stopTogether?: boolean | undefined; // If one is stopped, stop all. default: true
8975 };
8976
8977 /**
8978 * Starts an array of animations all at the same time. By default, if one
8979 * of the animations is stopped, they will all be stopped. You can override
8980 * this with the `stopTogether` flag.
8981 */
8982 export function parallel(animations: Array<CompositeAnimation>, config?: ParallelConfig): CompositeAnimation;
8983
8984 type Mapping = { [key: string]: Mapping } | AnimatedValue;
8985 interface EventConfig<T> {
8986 listener?: ((event: NativeSyntheticEvent<T>) => void) | undefined;
8987 useNativeDriver: boolean;
8988 }
8989
8990 /**
8991 * Takes an array of mappings and extracts values from each arg accordingly,
8992 * then calls `setValue` on the mapped outputs. e.g.
8993 *
8994 *```javascript
8995 * onScroll={Animated.event(
8996 * [{nativeEvent: {contentOffset: {x: this._scrollX}}}]
8997 * {listener}, // Optional async listener
8998 * )
8999 * ...
9000 * onPanResponderMove: Animated.event([
9001 * null, // raw event arg ignored
9002 * {dx: this._panX}, // gestureState arg
9003 * ]),
9004 *```
9005 */
9006 export function event<T>(argMapping: Array<Mapping | null>, config?: EventConfig<T>): (...args: any[]) => void;
9007
9008 export type ComponentProps<T> = T extends React.ComponentType<infer P> | React.Component<infer P> ? P : never;
9009
9010 export type LegacyRef<C> = { getNode(): C };
9011
9012 type Nullable = undefined | null;
9013 type Primitive = string | number | boolean | symbol;
9014 type Builtin = Function | Date | Error | RegExp;
9015
9016 interface WithAnimatedArray<P> extends Array<WithAnimatedValue<P>> {}
9017 type WithAnimatedObject<T> = {
9018 [K in keyof T]: WithAnimatedValue<T[K]>;
9019 };
9020
9021 export type WithAnimatedValue<T> = T extends Builtin | Nullable
9022 ? T
9023 : T extends Primitive
9024 ? T | Value | AnimatedInterpolation // add `Value` and `AnimatedInterpolation` but also preserve original T
9025 : T extends Array<infer P>
9026 ? WithAnimatedArray<P>
9027 : T extends {}
9028 ? WithAnimatedObject<T>
9029 : T; // in case it's something we don't yet know about (for .e.g bigint)
9030
9031 type NonAnimatedProps = 'key' | 'ref';
9032
9033 type TAugmentRef<T> = T extends React.Ref<infer R> ? React.Ref<R | LegacyRef<R>> : never;
9034
9035 export type AnimatedProps<T> = {
9036 [key in keyof T]: key extends NonAnimatedProps
9037 ? key extends 'ref'
9038 ? TAugmentRef<T[key]>
9039 : T[key]
9040 : WithAnimatedValue<T[key]>;
9041 };
9042
9043 export interface AnimatedComponent<T extends React.ComponentType<any>>
9044 extends React.FC<AnimatedProps<React.ComponentPropsWithRef<T>>> {}
9045
9046 export type AnimatedComponentOptions = {
9047 collapsable?: boolean;
9048 };
9049
9050 /**
9051 * Make any React component Animatable. Used to create `Animated.View`, etc.
9052 */
9053 export function createAnimatedComponent<T extends React.ComponentType<any>>(component: T, options?: AnimatedComponentOptions): AnimatedComponent<T>;
9054
9055 /**
9056 * Animated variants of the basic native views. Accepts Animated.Value for
9057 * props and style.
9058 */
9059 export const View: AnimatedComponent<typeof _View>;
9060 export const Image: AnimatedComponent<typeof _Image>;
9061 export const Text: AnimatedComponent<typeof _Text>;
9062 export const ScrollView: AnimatedComponent<typeof _ScrollView>;
9063
9064 /**
9065 * FlatList and SectionList infer generic Type defined under their `data` and `section` props.
9066 */
9067 export class FlatList<ItemT = any> extends React.Component<AnimatedProps<FlatListProps<ItemT>>> {}
9068 export class SectionList<ItemT = any, SectionT = DefaultSectionT> extends React.Component<
9069 AnimatedProps<SectionListProps<ItemT, SectionT>>
9070 > {}
9071}
9072
9073// tslint:disable-next-line:interface-name
9074export interface I18nManagerStatic {
9075 getConstants: () => {
9076 isRTL: boolean;
9077 doLeftAndRightSwapInRTL: boolean;
9078 localeIdentifier?: string | null | undefined;
9079 };
9080 allowRTL: (allowRTL: boolean) => void;
9081 forceRTL: (forceRTL: boolean) => void;
9082 swapLeftAndRightInRTL: (swapLeftAndRight: boolean) => void;
9083 isRTL: boolean;
9084 doLeftAndRightSwapInRTL: boolean;
9085}
9086
9087export interface OpenCameraDialogOptions {
9088 /** Defaults to false */
9089 videoMode?: boolean | undefined;
9090}
9091
9092export interface OpenSelectDialogOptions {
9093 /** Defaults to true */
9094 showImages?: boolean | undefined;
9095 /** Defaults to false */
9096 showVideos?: boolean | undefined;
9097}
9098
9099/** [imageURL|tempImageTag, height, width] */
9100export type ImagePickerResult = [string, number, number];
9101
9102export interface ImagePickerIOSStatic {
9103 canRecordVideos(callback: (value: boolean) => void): void;
9104 canUseCamera(callback: (value: boolean) => void): void;
9105 openCameraDialog(
9106 config: OpenCameraDialogOptions,
9107 successCallback: (args: ImagePickerResult) => void,
9108 cancelCallback: (args: any[]) => void,
9109 ): void;
9110 openSelectDialog(
9111 config: OpenSelectDialogOptions,
9112 successCallback: (args: ImagePickerResult) => void,
9113 cancelCallback: (args: any[]) => void,
9114 ): void;
9115}
9116
9117export interface ImageStoreStatic {
9118 /**
9119 * Check if the ImageStore contains image data for the specified URI.
9120 * @platform ios
9121 */
9122 hasImageForTag(uri: string, callback: (hasImage: boolean) => void): void;
9123
9124 /**
9125 * Delete an image from the ImageStore. Images are stored in memory and
9126 * must be manually removed when you are finished with them, otherwise they
9127 * will continue to use up RAM until the app is terminated. It is safe to
9128 * call `removeImageForTag()` without first calling `hasImageForTag()`, it
9129 * will simply fail silently.
9130 * @platform ios
9131 */
9132 removeImageForTag(uri: string): void;
9133
9134 /**
9135 * Stores a base64-encoded image in the ImageStore, and returns a URI that
9136 * can be used to access or display the image later. Images are stored in
9137 * memory only, and must be manually deleted when you are finished with
9138 * them by calling `removeImageForTag()`.
9139 *
9140 * Note that it is very inefficient to transfer large quantities of binary
9141 * data between JS and native code, so you should avoid calling this more
9142 * than necessary.
9143 * @platform ios
9144 */
9145 addImageFromBase64(base64ImageData: string, success: (uri: string) => void, failure: (error: any) => void): void;
9146
9147 /**
9148 * Retrieves the base64-encoded data for an image in the ImageStore. If the
9149 * specified URI does not match an image in the store, the failure callback
9150 * will be called.
9151 *
9152 * Note that it is very inefficient to transfer large quantities of binary
9153 * data between JS and native code, so you should avoid calling this more
9154 * than necessary. To display an image in the ImageStore, you can just pass
9155 * the URI to an `<Image/>` component; there is no need to retrieve the
9156 * base64 data.
9157 */
9158 getBase64ForTag(uri: string, success: (base64ImageData: string) => void, failure: (error: any) => void): void;
9159}
9160
9161//
9162// Turbo Module
9163//
9164
9165export interface TurboModule {
9166 getConstants?(): {}
9167}
9168
9169export const TurboModuleRegistry: {
9170 get<T extends TurboModule>(name: string): T | null;
9171 getEnforcing<T extends TurboModule>(name: string): T;
9172}
9173
9174//
9175// Interfacing with Native Modules
9176// https://reactnative.dev/docs/native-modules-ios
9177//
9178
9179export interface NativeEventSubscription {
9180 /**
9181 * Call this method to un-subscribe from a native-event
9182 */
9183 remove(): void;
9184}
9185
9186/**
9187 * Receive events from native-code
9188 * Deprecated - subclass NativeEventEmitter to create granular event modules instead of
9189 * adding all event listeners directly to RCTNativeAppEventEmitter.
9190 * @see https://github.com/facebook/react-native/blob/0.34-stable\Libraries\EventEmitter\RCTNativeAppEventEmitter.js
9191 * @see https://reactnative.dev/docs/native-modules-ios#sending-events-to-javascript
9192 */
9193type RCTNativeAppEventEmitter = DeviceEventEmitterStatic;
9194
9195interface ImageCropData {
9196 /**
9197 * The top-left corner of the cropped image, specified in the original
9198 * image's coordinate space.
9199 */
9200 offset: {
9201 x: number;
9202 y: number;
9203 };
9204
9205 /**
9206 * The size (dimensions) of the cropped image, specified in the original
9207 * image's coordinate space.
9208 */
9209 size: {
9210 width: number;
9211 height: number;
9212 };
9213
9214 /**
9215 * (Optional) size to scale the cropped image to.
9216 */
9217 displaySize?: { width: number; height: number } | undefined;
9218
9219 /**
9220 * (Optional) the resizing mode to use when scaling the image. If the
9221 * `displaySize` param is not specified, this has no effect.
9222 */
9223 resizeMode?: 'contain' | 'cover' | 'stretch' | undefined;
9224}
9225
9226interface ImageEditorStatic {
9227 /**
9228 * Crop the image specified by the URI param. If URI points to a remote
9229 * image, it will be downloaded automatically. If the image cannot be
9230 * loaded/downloaded, the failure callback will be called.
9231 *
9232 * If the cropping process is successful, the resultant cropped image
9233 * will be stored in the ImageStore, and the URI returned in the success
9234 * callback will point to the image in the store. Remember to delete the
9235 * cropped image from the ImageStore when you are done with it.
9236 */
9237 cropImage(
9238 uri: string,
9239 cropData: ImageCropData,
9240 success: (uri: string) => void,
9241 failure: (error: Object) => void,
9242 ): void;
9243}
9244
9245export type KeyboardEventName =
9246 | 'keyboardWillShow'
9247 | 'keyboardDidShow'
9248 | 'keyboardWillHide'
9249 | 'keyboardDidHide'
9250 | 'keyboardWillChangeFrame'
9251 | 'keyboardDidChangeFrame';
9252
9253export type KeyboardEventEasing = 'easeIn' | 'easeInEaseOut' | 'easeOut' | 'linear' | 'keyboard';
9254
9255type ScreenRect = {
9256 screenX: number;
9257 screenY: number;
9258 width: number;
9259 height: number;
9260};
9261
9262interface KeyboardEventIOS {
9263 /**
9264 * @platform ios
9265 */
9266 startCoordinates: ScreenRect;
9267 /**
9268 * @platform ios
9269 */
9270 isEventFromThisApp: boolean;
9271}
9272
9273export interface KeyboardEvent extends Partial<KeyboardEventIOS> {
9274 /**
9275 * Always set to 0 on Android.
9276 */
9277 duration: number;
9278 /**
9279 * Always set to "keyboard" on Android.
9280 */
9281 easing: KeyboardEventEasing;
9282 endCoordinates: ScreenRect;
9283}
9284
9285type KeyboardEventListener = (event: KeyboardEvent) => void;
9286
9287export interface KeyboardStatic extends NativeEventEmitter {
9288 /**
9289 * Dismisses the active keyboard and removes focus.
9290 */
9291 dismiss: () => void;
9292 /**
9293 * The `addListener` function connects a JavaScript function to an identified native
9294 * keyboard notification event.
9295 *
9296 * This function then returns the reference to the listener.
9297 *
9298 * {string} eventName The `nativeEvent` is the string that identifies the event you're listening for. This
9299 *can be any of the following:
9300 *
9301 * - `keyboardWillShow`
9302 * - `keyboardDidShow`
9303 * - `keyboardWillHide`
9304 * - `keyboardDidHide`
9305 * - `keyboardWillChangeFrame`
9306 * - `keyboardDidChangeFrame`
9307 *
9308 * Note that if you set `android:windowSoftInputMode` to `adjustResize` or `adjustNothing`,
9309 * only `keyboardDidShow` and `keyboardDidHide` events will be available on Android.
9310 * `keyboardWillShow` as well as `keyboardWillHide` are generally not available on Android
9311 * since there is no native corresponding event.
9312 *
9313 * {function} callback function to be called when the event fires.
9314 */
9315 addListener: (eventType: KeyboardEventName, listener: KeyboardEventListener) => EmitterSubscription;
9316 /**
9317 * Useful for syncing TextInput (or other keyboard accessory view) size of
9318 * position changes with keyboard movements.
9319 */
9320 scheduleLayoutAnimation: (event: KeyboardEvent) => void;
9321}
9322
9323/**
9324 * The DevSettings module exposes methods for customizing settings for developers in development.
9325 */
9326export interface DevSettingsStatic extends NativeEventEmitter {
9327 /**
9328 * Adds a custom menu item to the developer menu.
9329 *
9330 * @param title - The title of the menu item. Is internally used as id and should therefore be unique.
9331 * @param handler - The callback invoked when pressing the menu item.
9332 */
9333 addMenuItem(title: string, handler: () => any): void;
9334
9335 /**
9336 * Reload the application.
9337 *
9338 * @param reason
9339 */
9340 reload(reason?: string): void;
9341}
9342
9343export const DevSettings: DevSettingsStatic;
9344
9345//////////////////////////////////////////////////////////////////////////
9346//
9347// R E - E X P O R T S
9348//
9349//////////////////////////////////////////////////////////////////////////
9350
9351//////////// APIS //////////////
9352export const ActionSheetIOS: ActionSheetIOSStatic;
9353export type ActionSheetIOS = ActionSheetIOSStatic;
9354
9355export const AccessibilityInfo: AccessibilityInfoStatic;
9356export type AccessibilityInfo = AccessibilityInfoStatic;
9357
9358export const Alert: AlertStatic;
9359export type Alert = AlertStatic;
9360
9361export const AppState: AppStateStatic;
9362export type AppState = AppStateStatic;
9363
9364/**
9365 * AsyncStorage has been extracted from react-native core and will be removed in a future release.
9366 * It can now be installed and imported from `@react-native-community/async-storage` instead of 'react-native'.
9367 * @see https://github.com/react-native-community/async-storage
9368 * @deprecated
9369 */
9370export const AsyncStorage: AsyncStorageStatic;
9371/**
9372 * AsyncStorage has been extracted from react-native core and will be removed in a future release.
9373 * It can now be installed and imported from `@react-native-community/async-storage` instead of 'react-native'.
9374 * @see https://github.com/react-native-community/async-storage
9375 * @deprecated
9376 */
9377export type AsyncStorage = AsyncStorageStatic;
9378
9379export const BackHandler: BackHandlerStatic;
9380export type BackHandler = BackHandlerStatic;
9381
9382/**
9383 * CameraRoll has been removed from React Native.
9384 * It can now be installed and imported from `@react-native-community/cameraroll` instead of 'react-native'.
9385 * @see https://github.com/react-native-community/react-native-cameraroll
9386 * @deprecated
9387 */
9388export const CameraRoll: CameraRollStatic;
9389/**
9390 * CameraRoll has been removed from React Native.
9391 * It can now be installed and imported from `@react-native-community/cameraroll` instead of 'react-native'.
9392 * @see https://github.com/react-native-community/react-native-cameraroll
9393 * @deprecated
9394 */
9395export type CameraRoll = CameraRollStatic;
9396
9397/**
9398 * Clipboard has been extracted from react-native core and will be removed in a future release.
9399 * It can now be installed and imported from `@react-native-community/clipboard` instead of 'react-native'.
9400 * @see https://github.com/react-native-community/clipboard
9401 * @deprecated
9402 */
9403export const Clipboard: ClipboardStatic;
9404/**
9405 * Clipboard has been extracted from react-native core and will be removed in a future release.
9406 * It can now be installed and imported from `@react-native-community/clipboard` instead of 'react-native'.
9407 * @see https://github.com/react-native-community/clipboard
9408 * @deprecated
9409 */
9410export type Clipboard = ClipboardStatic;
9411
9412/**
9413 * DatePickerAndroid has been merged with DatePickerIOS and will be removed in a future release.
9414 * It can now be installed and imported from `@react-native-community/datetimepicker` instead of 'react-native'.
9415 * @see https://github.com/react-native-community/datetimepicker
9416 * @deprecated
9417 */
9418export const DatePickerAndroid: DatePickerAndroidStatic;
9419/**
9420 * DatePickerAndroid has been merged with DatePickerIOS and will be removed in a future release.
9421 * It can now be installed and imported from `@react-native-community/datetimepicker` instead of 'react-native'.
9422 * @see https://github.com/react-native-community/datetimepicker
9423 * @deprecated
9424 */
9425export type DatePickerAndroid = DatePickerAndroidStatic;
9426
9427export const Dimensions: Dimensions;
9428
9429export type Easing = EasingStatic;
9430export const Easing: EasingStatic;
9431
9432/** https://reactnative.dev/blog/2016/08/19/right-to-left-support-for-react-native-apps */
9433export const I18nManager: I18nManagerStatic;
9434export type I18nManager = I18nManagerStatic;
9435
9436/**
9437 * ImageEditor has been removed from React Native.
9438 * It can now be installed and imported from `@react-native-community/image-editor` instead of 'react-native'.
9439 * @see https://github.com/react-native-community/react-native-image-editor
9440 * @deprecated
9441 */
9442export const ImageEditor: ImageEditorStatic;
9443export type ImageEditor = ImageEditorStatic;
9444
9445/**
9446 * ImagePickerIOS has been extracted from react-native core and will be removed in a future release.
9447 * Please upgrade to use either `@react-native-community/react-native-image-picker` or 'expo-image-picker'.
9448 * If you cannot upgrade to a different library, please install the deprecated `@react-native-community/image-picker-ios` package.
9449 * @see https://github.com/react-native-community/react-native-image-picker-ios
9450 * @deprecated
9451 */
9452export const ImagePickerIOS: ImagePickerIOSStatic;
9453export type ImagePickerIOS = ImagePickerIOSStatic;
9454
9455/**
9456 * ImageStore has been removed from React Native.
9457 * To get a base64-encoded string from a local image use either of the following third-party libraries:
9458 * * expo-file-system: `readAsStringAsync(filepath, 'base64')`
9459 * * react-native-fs: `readFile(filepath, 'base64')`
9460 * @deprecated
9461 */
9462export const ImageStore: ImageStoreStatic;
9463export type ImageStore = ImageStoreStatic;
9464
9465export const InteractionManager: InteractionManagerStatic;
9466
9467export const Keyboard: KeyboardStatic;
9468
9469export const LayoutAnimation: LayoutAnimationStatic;
9470export type LayoutAnimation = LayoutAnimationStatic;
9471
9472export const Linking: LinkingStatic;
9473export type Linking = LinkingStatic;
9474
9475export const LogBox: LogBoxStatic;
9476export type LogBox = LogBoxStatic;
9477
9478export const PanResponder: PanResponderStatic;
9479export type PanResponder = PanResponderStatic;
9480
9481export const PermissionsAndroid: PermissionsAndroidStatic;
9482export type PermissionsAndroid = PermissionsAndroidStatic;
9483
9484/**
9485 * PushNotificationIOS has been extracted from react-native core and will be removed in a future release.
9486 * It can now be installed and imported from `@react-native-community/push-notification-ios` instead of 'react-native'.
9487 * @see https://github.com/react-native-community/react-native-push-notification-ios
9488 * @deprecated
9489 */
9490export const PushNotificationIOS: PushNotificationIOSStatic;
9491/**
9492 * PushNotificationIOS has been extracted from react-native core and will be removed in a future release.
9493 * It can now be installed and imported from `@react-native-community/push-notification-ios` instead of 'react-native'.
9494 * @see https://github.com/react-native-community/react-native-push-notification-ios
9495 * @deprecated
9496 */
9497export type PushNotificationIOS = PushNotificationIOSStatic;
9498
9499export const Settings: SettingsStatic;
9500export type Settings = SettingsStatic;
9501
9502export const Share: ShareStatic;
9503export type Share = ShareStatic;
9504
9505export const Systrace: SystraceStatic;
9506export type Systrace = SystraceStatic;
9507
9508/**
9509 * TimePickerAndroid has been removed from React Native.
9510 * It can now be installed and imported from `@react-native-community/datetimepicker` instead of 'react-native'.
9511 * @see https://github.com/react-native-community/datetimepicker
9512 * @deprecated
9513 */
9514export const TimePickerAndroid: TimePickerAndroidStatic;
9515/**
9516 * TimePickerAndroid has been removed from React Native.
9517 * It can now be installed and imported from `@react-native-community/datetimepicker` instead of 'react-native'.
9518 * @see https://github.com/react-native-community/datetimepicker
9519 * @deprecated
9520 */
9521export type TimePickerAndroid = TimePickerAndroidStatic;
9522
9523export const ToastAndroid: ToastAndroidStatic;
9524export type ToastAndroid = ToastAndroidStatic;
9525
9526export const UIManager: UIManagerStatic;
9527export type UIManager = UIManagerStatic;
9528
9529export const Vibration: VibrationStatic;
9530export type Vibration = VibrationStatic;
9531
9532export const ShadowPropTypesIOS: ShadowPropTypesIOSStatic;
9533
9534//////////// Plugins //////////////
9535
9536export const DeviceEventEmitter: DeviceEventEmitterStatic;
9537
9538/**
9539 * The React Native implementation of the IOS RCTEventEmitter which is required when creating
9540 * a module that communicates with IOS
9541 */
9542type NativeModule = {
9543 /**
9544 * Add the provided eventType as an active listener
9545 * @param eventType name of the event for which we are registering listener
9546 */
9547 addListener: (eventType: string) => void;
9548
9549 /**
9550 * Remove a specified number of events. There are no eventTypes in this case, as
9551 * the native side doesn't remove the name, but only manages a counter of total
9552 * listeners
9553 * @param count number of listeners to remove (of any type)
9554 */
9555 removeListeners: (count: number) => void;
9556};
9557
9558/**
9559 * Abstract base class for implementing event-emitting modules. This implements
9560 * a subset of the standard EventEmitter node module API.
9561 */
9562declare class NativeEventEmitter extends EventEmitter {
9563 /**
9564 * @param nativeModule the NativeModule implementation. This is required on IOS and will throw
9565 * an invariant error if undefined.
9566 */
9567 constructor(nativeModule?: NativeModule);
9568
9569 /**
9570 * Add the specified listener, this call passes through to the NativeModule
9571 * addListener
9572 *
9573 * @param eventType name of the event for which we are registering listener
9574 * @param listener the listener function
9575 * @param context context of the listener
9576 */
9577 addListener(eventType: string, listener: (event: any) => void, context?: Object): EmitterSubscription;
9578
9579 /**
9580 * @param eventType name of the event whose registered listeners to remove
9581 */
9582 removeAllListeners(eventType: string): void;
9583
9584 /**
9585 * Removes a subscription created by the addListener, the EventSubscription#remove()
9586 * function actually calls through to this.
9587 */
9588 removeSubscription(subscription: EmitterSubscription): void;
9589}
9590
9591/**
9592 * Deprecated - subclass NativeEventEmitter to create granular event modules instead of
9593 * adding all event listeners directly to RCTNativeAppEventEmitter.
9594 */
9595export const NativeAppEventEmitter: RCTNativeAppEventEmitter;
9596
9597/**
9598 * Interface for NativeModules which allows to augment NativeModules with type informations.
9599 * See react-native-sensor-manager for example.
9600 */
9601interface NativeModulesStatic {
9602 [name: string]: any;
9603}
9604
9605/**
9606 * Native Modules written in ObjectiveC/Swift/Java exposed via the RCTBridge
9607 * Define lazy getters for each module. These will return the module if already loaded, or load it if not.
9608 * See https://reactnative.dev/docs/native-modules-ios
9609 * @example
9610 * const MyModule = NativeModules.ModuleName
9611 */
9612export const NativeModules: NativeModulesStatic;
9613export const Platform:
9614 | PlatformIOSStatic
9615 | PlatformAndroidStatic
9616 | PlatformWindowsOSStatic
9617 | PlatformMacOSStatic
9618 | PlatformWebStatic;
9619export const PixelRatio: PixelRatioStatic;
9620
9621/**
9622 * Creates values that can be used like React components which represent native
9623 * view managers. You should create JavaScript modules that wrap these values so
9624 * that the results are memoized. Example:
9625 *
9626 * const View = requireNativeComponent('RCTView');
9627 *
9628 * The concrete return type of `requireNativeComponent` is a string, but the declared type is
9629 * `HostComponent` because TypeScript assumes anonymous JSX intrinsics (e.g. a `string`) not
9630 * to have any props.
9631 */
9632export function requireNativeComponent<T>(viewName: string): HostComponent<T>;
9633
9634export function findNodeHandle(
9635 componentOrHandle: null | number | React.Component<any, any> | React.ComponentClass<any>,
9636): null | number;
9637
9638export function processColor(color?: number | ColorValue): ProcessedColorValue | null | undefined;
9639
9640/**
9641 * YellowBox has been replaced with LogBox.
9642 * @see LogBox
9643 * @deprecated
9644 */
9645export const YellowBox: React.ComponentClass<any, any> & { ignoreWarnings: (warnings: string[]) => void };
9646
9647/**
9648 * LogBox is enabled by default so there is no need to call unstable_enableLogBox() anymore. This is a no op and will be removed in the next version.
9649 * @deprecated
9650 */
9651export function unstable_enableLogBox(): void;
9652
9653/**
9654 * React Native also implements unstable_batchedUpdates
9655 */
9656export function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
9657export function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
9658export function unstable_batchedUpdates(callback: () => any): void;
9659
9660//////////////////////////////////////////////////////////////////////////
9661//
9662// Additional ( and controversial)
9663//
9664//////////////////////////////////////////////////////////////////////////
9665
9666export function __spread(target: any, ...sources: any[]): any;
9667
9668type ErrorHandlerCallback = (error: any, isFatal?: boolean) => void;
9669
9670export interface ErrorUtils {
9671 setGlobalHandler: (callback: ErrorHandlerCallback) => void;
9672 getGlobalHandler: () => ErrorHandlerCallback;
9673}
9674
9675//
9676// Add-Ons
9677//
9678export namespace addons {
9679 //FIXME: Documentation ?
9680 export interface TestModuleStatic {
9681 verifySnapshot: (done: (indicator?: any) => void) => void;
9682 markTestPassed: (indicator: any) => void;
9683 markTestCompleted: () => void;
9684 }
9685
9686 export const TestModule: TestModuleStatic;
9687 export type TestModule = TestModuleStatic;
9688}
9689
9690//
9691// Prop Types
9692//
9693export const ColorPropType: React.Validator<string>;
9694export const EdgeInsetsPropType: React.Validator<Insets>;
9695export const PointPropType: React.Validator<PointPropType>;
9696export const ViewPropTypes: React.ValidationMap<ViewProps>;
9697export const TextPropTypes: React.ValidationMap<TextProps>;
9698export const ImagePropTypes: React.ValidationMap<ImageProps>;
9699
9700declare global {
9701 interface NodeRequire {
9702 (id: string): any;
9703 }
9704
9705 var require: NodeRequire;
9706
9707 /**
9708 * Console polyfill
9709 * @see https://reactnative.dev/docs/javascript-environment#polyfills
9710 */
9711 interface Console {
9712 error(message?: any, ...optionalParams: any[]): void;
9713 info(message?: any, ...optionalParams: any[]): void;
9714 log(message?: any, ...optionalParams: any[]): void;
9715 warn(message?: any, ...optionalParams: any[]): void;
9716 trace(message?: any, ...optionalParams: any[]): void;
9717 debug(message?: any, ...optionalParams: any[]): void;
9718 table(...data: any[]): void;
9719 groupCollapsed(label?: string): void;
9720 groupEnd(): void;
9721 group(label?: string): void;
9722 /**
9723 * @deprecated Use LogBox.ignoreAllLogs(disable) instead
9724 */
9725 disableYellowBox: boolean;
9726 /**
9727 * @deprecated Use LogBox.ignoreLogs(patterns) instead
9728 */
9729 ignoredYellowBox: string[];
9730 }
9731
9732 var console: Console;
9733
9734 /**
9735 * This contains the non-native `XMLHttpRequest` object, which you can use if you want to route network requests
9736 * through DevTools (to trace them):
9737 *
9738 * global.XMLHttpRequest = global.originalXMLHttpRequest;
9739 *
9740 * @see https://github.com/facebook/react-native/issues/934
9741 */
9742 const originalXMLHttpRequest: any;
9743
9744 const __BUNDLE_START_TIME__: number;
9745 const ErrorUtils: ErrorUtils;
9746
9747 /**
9748 * This variable is set to true when react-native is running in Dev mode
9749 * @example
9750 * if (__DEV__) console.log('Running in dev mode')
9751 */
9752 const __DEV__: boolean;
9753
9754 const HermesInternal: null | {};
9755}
9756
\No newline at end of file