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