0
# Core APIs
1
2
Core React Native APIs enhanced for Windows platform with comprehensive system integration, app lifecycle management, and device interaction capabilities.
3
4
## Capabilities
5
6
### Application Management
7
8
#### AppRegistry
9
10
Central registry for React Native applications, components, and runnable functions with Windows-specific initialization support.
11
12
```typescript { .api }
13
/**
14
* Central registry for React Native applications and components
15
* Handles app initialization and component registration
16
*/
17
interface AppRegistry {
18
/** Register a React component as an application */
19
registerComponent(appKey: string, componentProvider: () => React.ComponentType): string;
20
/** Register a runnable function */
21
registerRunnable(appKey: string, run: Function): string;
22
/** Register a React component configuration */
23
registerConfig(config: AppConfig[]): void;
24
/** Get registered application */
25
getApplication(appKey: string): ApplicationSpec | undefined;
26
/** Get all registered applications */
27
getAppKeys(): string[];
28
/** Run an application */
29
runApplication(appKey: string, appParameters: AppParameters): void;
30
/** Unmount an application */
31
unmountApplicationComponentAtRootTag(rootTag: number): void;
32
/** Start headless task */
33
startHeadlessTask(taskId: number, taskKey: string, data: any): void;
34
}
35
36
interface AppConfig {
37
appKey: string;
38
component?: () => React.ComponentType;
39
run?: Function;
40
}
41
42
interface ApplicationSpec {
43
component?: React.ComponentType;
44
run?: Function;
45
}
46
47
interface AppParameters {
48
initialProps?: any;
49
fabric?: boolean;
50
}
51
52
declare const AppRegistry: AppRegistry;
53
```
54
55
#### AppState
56
57
Application state management providing lifecycle events and background/foreground state tracking.
58
59
```typescript { .api }
60
/**
61
* Application state management with lifecycle events
62
* Tracks background/foreground state and provides event listeners
63
*/
64
interface AppState {
65
/** Current application state */
66
readonly currentState: 'active' | 'background' | 'inactive' | 'unknown' | 'extension';
67
/** Add event listener for state changes */
68
addEventListener(
69
type: 'change' | 'memoryWarning' | 'focus' | 'blur',
70
handler: (state: string) => void
71
): void;
72
/** Remove event listener */
73
removeEventListener(
74
type: 'change' | 'memoryWarning' | 'focus' | 'blur',
75
handler: (state: string) => void
76
): void;
77
/** Check if app is available (deprecated) */
78
isAvailable(): boolean;
79
}
80
81
declare const AppState: AppState;
82
```
83
84
### Device & Platform Information
85
86
#### Platform
87
88
Platform detection and OS information with Windows-specific constants and utilities.
89
90
```typescript { .api }
91
/**
92
* Platform detection and OS information
93
* Provides Windows-specific constants and version detection
94
*/
95
interface Platform {
96
/** Operating system identifier */
97
readonly OS: 'windows' | 'ios' | 'android' | 'macos' | 'web';
98
/** Platform version string */
99
readonly Version: string;
100
/** Platform-specific constants */
101
readonly constants: PlatformConstants;
102
/** Platform-specific value selection */
103
select<T>(specifics: PlatformSelectSpec<T>): T;
104
/** Check if platform is TV */
105
isTV: boolean;
106
/** Check if platform is testing environment */
107
isTesting: boolean;
108
}
109
110
interface PlatformConstants {
111
reactNativeVersion: {
112
major: number;
113
minor: number;
114
patch: number;
115
prerelease?: string;
116
};
117
Version: string;
118
[key: string]: any;
119
}
120
121
interface PlatformSelectSpec<T> {
122
windows?: T;
123
ios?: T;
124
android?: T;
125
macos?: T;
126
web?: T;
127
native?: T;
128
default?: T;
129
}
130
131
declare const Platform: Platform;
132
```
133
134
#### DeviceInfo
135
136
Device information and capabilities detection for Windows devices.
137
138
```typescript { .api }
139
/**
140
* Device information and capabilities for Windows devices
141
* Provides device type, version, and capability detection
142
*/
143
interface DeviceInfo {
144
/** Get device constants */
145
getConstants(): DeviceConstants;
146
/** Check if device is tablet */
147
isTablet(): boolean;
148
/** Get device type */
149
getDeviceType(): 'Handset' | 'Tablet' | 'Desktop' | 'TV' | 'Unknown';
150
}
151
152
interface DeviceConstants {
153
Dimensions: {
154
window: Dimensions;
155
screen: Dimensions;
156
};
157
fontScale: number;
158
[key: string]: any;
159
}
160
161
declare const DeviceInfo: DeviceInfo;
162
```
163
164
#### Dimensions
165
166
Screen and window dimension management with dynamic updates and orientation support.
167
168
```typescript { .api }
169
/**
170
* Screen and window dimensions with dynamic updates
171
* Handles orientation changes and multi-monitor scenarios
172
*/
173
interface Dimensions {
174
/** Get dimensions for window or screen */
175
get(dim: 'window' | 'screen'): Dimensions;
176
/** Add change listener */
177
addEventListener(
178
type: 'change',
179
handler: (dimensionData: { window: Dimensions; screen: Dimensions }) => void
180
): void;
181
/** Remove change listener */
182
removeEventListener(
183
type: 'change',
184
handler: (dimensionData: { window: Dimensions; screen: Dimensions }) => void
185
): void;
186
}
187
188
interface Dimensions {
189
width: number;
190
height: number;
191
scale: number;
192
fontScale: number;
193
}
194
195
declare const Dimensions: Dimensions;
196
197
/**
198
* Hook for window dimensions with automatic updates
199
*/
200
function useWindowDimensions(): Dimensions;
201
```
202
203
#### PixelRatio
204
205
Pixel density utilities for high-DPI displays and responsive design.
206
207
```typescript { .api }
208
/**
209
* Pixel density utilities for high-DPI displays
210
* Handles Windows scaling and responsive design
211
*/
212
interface PixelRatio {
213
/** Get device pixel ratio */
214
get(): number;
215
/** Get font scale factor */
216
getFontScale(): number;
217
/** Get pixel size for given points */
218
getPixelSizeForLayoutSize(layoutSize: number): number;
219
/** Round to nearest pixel */
220
roundToNearestPixel(layoutSize: number): number;
221
/** Start detecting changes */
222
startDetecting(): void;
223
}
224
225
declare const PixelRatio: PixelRatio;
226
```
227
228
### Input & Interaction
229
230
#### Keyboard
231
232
Keyboard state management and event handling with Windows-specific features.
233
234
```typescript { .api }
235
/**
236
* Keyboard state management and event handling
237
* Includes Windows-specific keyboard features and shortcuts
238
*/
239
interface Keyboard {
240
/** Add keyboard event listener */
241
addListener(
242
eventName: KeyboardEventName,
243
callback: (event: KeyboardEvent) => void
244
): KeyboardEventSubscription;
245
/** Remove keyboard event listeners */
246
removeAllListeners(eventName?: KeyboardEventName): void;
247
/** Dismiss keyboard */
248
dismiss(): void;
249
/** Get keyboard metrics */
250
metrics(): KeyboardMetrics | null;
251
}
252
253
type KeyboardEventName =
254
| 'keyboardWillShow'
255
| 'keyboardDidShow'
256
| 'keyboardWillHide'
257
| 'keyboardDidHide'
258
| 'keyboardWillChangeFrame'
259
| 'keyboardDidChangeFrame';
260
261
interface KeyboardEvent {
262
duration?: number;
263
easing?: string;
264
endCoordinates: {
265
width: number;
266
height: number;
267
screenX: number;
268
screenY: number;
269
};
270
startCoordinates?: {
271
width: number;
272
height: number;
273
screenX: number;
274
screenY: number;
275
};
276
isEventFromThisApp?: boolean;
277
}
278
279
interface KeyboardMetrics {
280
height: number;
281
width: number;
282
screenX: number;
283
screenY: number;
284
}
285
286
interface KeyboardEventSubscription {
287
remove(): void;
288
}
289
290
declare const Keyboard: Keyboard;
291
```
292
293
#### BackHandler
294
295
Hardware back button handling for Windows devices with back gesture support.
296
297
```typescript { .api }
298
/**
299
* Hardware back button and gesture handling
300
* Supports Windows back navigation patterns
301
*/
302
interface BackHandler {
303
/** Exit application */
304
exitApp(): void;
305
/** Add back button event listener */
306
addEventListener(
307
eventName: 'hardwareBackPress',
308
handler: () => boolean
309
): BackHandlerSubscription;
310
/** Remove back button event listener */
311
removeEventListener(
312
eventName: 'hardwareBackPress',
313
handler: () => boolean
314
): void;
315
}
316
317
interface BackHandlerSubscription {
318
remove(): void;
319
}
320
321
declare const BackHandler: BackHandler;
322
```
323
324
#### Vibration
325
326
Device vibration API with Windows haptic feedback support.
327
328
```typescript { .api }
329
/**
330
* Device vibration API with haptic feedback
331
* Supports Windows haptic patterns and intensity
332
*/
333
interface Vibration {
334
/** Vibrate with pattern */
335
vibrate(pattern?: number | number[], repeat?: boolean): void;
336
/** Cancel vibration */
337
cancel(): void;
338
}
339
340
declare const Vibration: Vibration;
341
```
342
343
### Animation & Visual Effects
344
345
#### Animated
346
347
Comprehensive animation library with Windows-optimized performance and native driver support.
348
349
```typescript { .api }
350
/**
351
* Comprehensive animation library with native driver support
352
* Windows-optimized performance and smooth transitions
353
*/
354
interface Animated {
355
/** Create animated value */
356
Value: typeof AnimatedValue;
357
/** Create animated value XY */
358
ValueXY: typeof AnimatedValueXY;
359
/** Timing animation */
360
timing: (
361
value: AnimatedValue,
362
config: TimingAnimationConfig
363
) => CompositeAnimation;
364
/** Spring animation */
365
spring: (
366
value: AnimatedValue,
367
config: SpringAnimationConfig
368
) => CompositeAnimation;
369
/** Decay animation */
370
decay: (
371
value: AnimatedValue,
372
config: DecayAnimationConfig
373
) => CompositeAnimation;
374
/** Parallel animations */
375
parallel: (
376
animations: CompositeAnimation[],
377
config?: ParallelConfig
378
) => CompositeAnimation;
379
/** Sequential animations */
380
sequence: (animations: CompositeAnimation[]) => CompositeAnimation;
381
/** Delay animation */
382
delay: (time: number) => CompositeAnimation;
383
/** Stagger animations */
384
stagger: (
385
time: number,
386
animations: CompositeAnimation[]
387
) => CompositeAnimation;
388
/** Loop animation */
389
loop: (
390
animation: CompositeAnimation,
391
config?: LoopAnimationConfig
392
) => CompositeAnimation;
393
/** Create animated component */
394
createAnimatedComponent: <T>(component: T) => T;
395
/** Add listener to value */
396
addListener: (value: AnimatedValue, listener: AnimatedListener) => string;
397
/** Remove listener */
398
removeListener: (value: AnimatedValue, id: string) => void;
399
/** Remove all listeners */
400
removeAllListeners: (value: AnimatedValue) => void;
401
/** Animated components */
402
View: AnimatedComponent<typeof View>;
403
Text: AnimatedComponent<typeof Text>;
404
ScrollView: AnimatedComponent<typeof ScrollView>;
405
Image: AnimatedComponent<typeof Image>;
406
FlatList: AnimatedComponent<typeof FlatList>;
407
SectionList: AnimatedComponent<typeof SectionList>;
408
}
409
410
class AnimatedValue {
411
constructor(value: number);
412
setValue(value: number): void;
413
setOffset(offset: number): void;
414
flattenOffset(): void;
415
extractOffset(): void;
416
addListener(callback: (value: { value: number }) => void): string;
417
removeListener(id: string): void;
418
removeAllListeners(): void;
419
stopAnimation(callback?: (value: number) => void): void;
420
resetAnimation(callback?: (value: number) => void): void;
421
interpolate(config: InterpolationConfig): AnimatedInterpolation;
422
}
423
424
declare const Animated: Animated;
425
```
426
427
#### Easing
428
429
Easing functions for smooth animations with Windows-native timing curves.
430
431
```typescript { .api }
432
/**
433
* Easing functions for smooth animations
434
* Includes Windows-native timing curves
435
*/
436
interface Easing {
437
/** Linear easing */
438
linear: (t: number) => number;
439
/** Ease in */
440
in: (easing: (t: number) => number) => (t: number) => number;
441
/** Ease out */
442
out: (easing: (t: number) => number) => (t: number) => number;
443
/** Ease in and out */
444
inOut: (easing: (t: number) => number) => (t: number) => number;
445
/** Quadratic easing */
446
quad: (t: number) => number;
447
/** Cubic easing */
448
cubic: (t: number) => number;
449
/** Polynomial easing */
450
poly: (n: number) => (t: number) => number;
451
/** Sine easing */
452
sin: (t: number) => number;
453
/** Circle easing */
454
circle: (t: number) => number;
455
/** Exponential easing */
456
exp: (t: number) => number;
457
/** Elastic easing */
458
elastic: (bounciness?: number) => (t: number) => number;
459
/** Back easing */
460
back: (s?: number) => (t: number) => number;
461
/** Bounce easing */
462
bounce: (t: number) => number;
463
/** Bezier easing curve */
464
bezier: (x1: number, y1: number, x2: number, y2: number) => (t: number) => number;
465
}
466
467
declare const Easing: Easing;
468
```
469
470
#### LayoutAnimation
471
472
Layout change animations with Windows-specific transition effects.
473
474
```typescript { .api }
475
/**
476
* Layout change animations with Windows transition effects
477
* Animates layout changes automatically
478
*/
479
interface LayoutAnimation {
480
/** Configure next layout animation */
481
configureNext(config: LayoutAnimationConfig, onAnimationDidEnd?: () => void): void;
482
/** Create layout animation config */
483
create(
484
duration: number,
485
type?: LayoutAnimationType,
486
creationProp?: LayoutAnimationProperty
487
): LayoutAnimationConfig;
488
/** Predefined presets */
489
Presets: {
490
easeInEaseOut: LayoutAnimationConfig;
491
linear: LayoutAnimationConfig;
492
spring: LayoutAnimationConfig;
493
};
494
/** Animation types */
495
Types: {
496
spring: LayoutAnimationType;
497
linear: LayoutAnimationType;
498
easeInEaseOut: LayoutAnimationType;
499
easeIn: LayoutAnimationType;
500
easeOut: LayoutAnimationType;
501
keyboard: LayoutAnimationType;
502
};
503
/** Animation properties */
504
Properties: {
505
opacity: LayoutAnimationProperty;
506
scaleX: LayoutAnimationProperty;
507
scaleY: LayoutAnimationProperty;
508
scaleXY: LayoutAnimationProperty;
509
};
510
}
511
512
interface LayoutAnimationConfig {
513
duration: number;
514
create?: LayoutAnimationAnim;
515
update?: LayoutAnimationAnim;
516
delete?: LayoutAnimationAnim;
517
}
518
519
interface LayoutAnimationAnim {
520
duration?: number;
521
delay?: number;
522
springDamping?: number;
523
initialVelocity?: number;
524
type?: LayoutAnimationType;
525
property?: LayoutAnimationProperty;
526
}
527
528
type LayoutAnimationType = 'spring' | 'linear' | 'easeInEaseOut' | 'easeIn' | 'easeOut' | 'keyboard';
529
type LayoutAnimationProperty = 'opacity' | 'scaleX' | 'scaleY' | 'scaleXY';
530
531
declare const LayoutAnimation: LayoutAnimation;
532
```
533
534
### Gesture & Interaction
535
536
#### InteractionManager
537
538
Interaction and timing management for smooth user experience and performance optimization.
539
540
```typescript { .api }
541
/**
542
* Interaction and timing management for smooth UX
543
* Coordinates animations with user interactions
544
*/
545
interface InteractionManager {
546
/** Run after interactions */
547
runAfterInteractions(task?: () => any): Promise<any>;
548
/** Create interaction handle */
549
createInteractionHandle(): number;
550
/** Clear interaction handle */
551
clearInteractionHandle(handle: number): void;
552
/** Add listener for interaction state changes */
553
addListener(callback: (hasActiveInteractions: boolean) => void): object;
554
/** Set deadline for interactions */
555
setDeadline(deadline: number): void;
556
}
557
558
declare const InteractionManager: InteractionManager;
559
```
560
561
#### PanResponder
562
563
Gesture recognition system for touch and mouse input with Windows-specific enhancements.
564
565
```typescript { .api }
566
/**
567
* Gesture recognition system for touch and mouse input
568
* Handles complex gestures and multi-touch scenarios
569
*/
570
interface PanResponder {
571
/** Create pan responder */
572
create(config: PanResponderConfig): PanResponderInstance;
573
}
574
575
interface PanResponderConfig {
576
/** Should become responder on start */
577
onStartShouldSetPanResponder?: (
578
event: GestureResponderEvent,
579
gestureState: PanResponderGestureState
580
) => boolean;
581
/** Should become responder on move */
582
onMoveShouldSetPanResponder?: (
583
event: GestureResponderEvent,
584
gestureState: PanResponderGestureState
585
) => boolean;
586
/** Responder grant handler */
587
onPanResponderGrant?: (
588
event: GestureResponderEvent,
589
gestureState: PanResponderGestureState
590
) => void;
591
/** Responder start handler */
592
onPanResponderStart?: (
593
event: GestureResponderEvent,
594
gestureState: PanResponderGestureState
595
) => void;
596
/** Responder move handler */
597
onPanResponderMove?: (
598
event: GestureResponderEvent,
599
gestureState: PanResponderGestureState
600
) => void;
601
/** Responder release handler */
602
onPanResponderRelease?: (
603
event: GestureResponderEvent,
604
gestureState: PanResponderGestureState
605
) => void;
606
/** Responder terminate handler */
607
onPanResponderTerminate?: (
608
event: GestureResponderEvent,
609
gestureState: PanResponderGestureState
610
) => void;
611
}
612
613
interface PanResponderInstance {
614
panHandlers: {
615
onStartShouldSetResponder: (event: GestureResponderEvent) => boolean;
616
onMoveShouldSetResponder: (event: GestureResponderEvent) => boolean;
617
onResponderGrant: (event: GestureResponderEvent) => void;
618
onResponderMove: (event: GestureResponderEvent) => void;
619
onResponderRelease: (event: GestureResponderEvent) => void;
620
onResponderTerminate: (event: GestureResponderEvent) => void;
621
};
622
}
623
624
interface PanResponderGestureState {
625
stateID: number;
626
moveX: number;
627
moveY: number;
628
x0: number;
629
y0: number;
630
dx: number;
631
dy: number;
632
vx: number;
633
vy: number;
634
numberActiveTouches: number;
635
}
636
637
interface GestureResponderEvent {
638
nativeEvent: {
639
changedTouches: Touch[];
640
identifier: number;
641
locationX: number;
642
locationY: number;
643
pageX: number;
644
pageY: number;
645
target: number;
646
timestamp: number;
647
touches: Touch[];
648
};
649
}
650
651
interface Touch {
652
identifier: number;
653
locationX: number;
654
locationY: number;
655
pageX: number;
656
pageY: number;
657
target: number;
658
timestamp: number;
659
}
660
661
declare const PanResponder: PanResponder;
662
```
663
664
### System Integration
665
666
#### Linking
667
668
Deep linking and URL handling with Windows protocol registration and app launching.
669
670
```typescript { .api }
671
/**
672
* Deep linking and URL handling with Windows protocol support
673
* Handles app launching and protocol registration
674
*/
675
interface Linking {
676
/** Add URL change listener */
677
addEventListener(
678
type: 'url',
679
handler: (event: { url: string }) => void
680
): void;
681
/** Remove URL change listener */
682
removeEventListener(
683
type: 'url',
684
handler: (event: { url: string }) => void
685
): void;
686
/** Open URL */
687
openURL(url: string): Promise<void>;
688
/** Check if URL can be opened */
689
canOpenURL(url: string): Promise<boolean>;
690
/** Get initial URL */
691
getInitialURL(): Promise<string | null>;
692
/** Open settings */
693
openSettings(): Promise<void>;
694
/** Send intent (Windows specific) */
695
sendIntent(action: string, extras?: object[]): Promise<void>;
696
}
697
698
declare const Linking: Linking;
699
```
700
701
#### Share
702
703
Native sharing capabilities with Windows sharing contract integration.
704
705
```typescript { .api }
706
/**
707
* Native sharing with Windows sharing contract integration
708
* Supports files, URLs, and custom content types
709
*/
710
interface Share {
711
/** Share content */
712
share(
713
content: ShareContent,
714
options?: ShareOptions
715
): Promise<ShareAction>;
716
/** Share single file */
717
shareSingle(options: ShareSingleOptions): Promise<ShareAction>;
718
}
719
720
interface ShareContent {
721
/** Message to share */
722
message?: string;
723
/** URL to share */
724
url?: string;
725
/** Title for share dialog */
726
title?: string;
727
}
728
729
interface ShareOptions {
730
/** Dialog title */
731
dialogTitle?: string;
732
/** Exclude activity types */
733
excludedActivityTypes?: string[];
734
/** Anchor point for iPad */
735
anchor?: number;
736
/** Subject for email sharing */
737
subject?: string;
738
}
739
740
interface ShareSingleOptions {
741
/** Content to share */
742
message?: string;
743
/** URL to share */
744
url?: string;
745
/** Social network */
746
social?: 'facebook' | 'twitter' | 'whatsapp' | 'instagram' | 'email' | 'sms';
747
/** File path */
748
filename?: string;
749
}
750
751
interface ShareAction {
752
/** Action type */
753
action: 'sharedAction' | 'dismissedAction';
754
/** Activity type */
755
activityType?: string;
756
}
757
758
declare const Share: Share;
759
```
760
761
### Development & Debugging
762
763
#### DevSettings
764
765
Development settings and debugging utilities for Windows development environment.
766
767
```typescript { .api }
768
/**
769
* Development settings and debugging utilities
770
* Windows development environment configuration
771
*/
772
interface DevSettings {
773
/** Add menu item to dev menu */
774
addMenuItem(title: string, handler: () => void): void;
775
/** Reload app */
776
reload(): void;
777
/** Open dev menu */
778
openMenu(): void;
779
}
780
781
declare const DevSettings: DevSettings;
782
```
783
784
#### LogBox
785
786
Development error and warning display system with Windows-native styling.
787
788
```typescript { .api }
789
/**
790
* Development error and warning display
791
* Windows-native styling and integration
792
*/
793
interface LogBox {
794
/** Install console error handler */
795
install(): void;
796
/** Uninstall console error handler */
797
uninstall(): void;
798
/** Ignore specific log patterns */
799
ignoreLogs(patterns: (string | RegExp)[]): void;
800
/** Ignore all logs */
801
ignoreAllLogs(ignore?: boolean): void;
802
}
803
804
declare const LogBox: LogBox;
805
```
806
807
### Device & System APIs
808
809
#### AccessibilityInfo
810
811
Enhanced Windows accessibility information and screen reader support.
812
813
```typescript { .api }
814
/**
815
* Enhanced Windows accessibility information and screen reader support
816
*/
817
interface AccessibilityInfo {
818
/** Check if screen reader is enabled */
819
isScreenReaderEnabled(): Promise<boolean>;
820
/** Add screen reader change listener */
821
addEventListener(
822
eventName: 'screenReaderChanged',
823
handler: (isEnabled: boolean) => void
824
): EventSubscription;
825
/** Remove event listener */
826
removeEventListener(
827
eventName: 'screenReaderChanged',
828
handler: (isEnabled: boolean) => void
829
): void;
830
/** Announce text to screen reader */
831
announceForAccessibility(announcement: string): void;
832
/** Set accessibility focus */
833
setAccessibilityFocus(reactTag: number): void;
834
}
835
836
declare const AccessibilityInfo: AccessibilityInfo;
837
```
838
839
#### Dimensions
840
841
Device dimension information and orientation change handling.
842
843
```typescript { .api }
844
/**
845
* Device dimension information and orientation change handling
846
*/
847
interface Dimensions {
848
/** Get screen dimensions */
849
get(dim: 'window' | 'screen'): ScaledSize;
850
/** Add dimension change listener */
851
addEventListener(
852
type: 'change',
853
handler: (dimensions: { window: ScaledSize; screen: ScaledSize }) => void
854
): EventSubscription;
855
/** Remove dimension change listener */
856
removeEventListener(
857
type: 'change',
858
handler: (dimensions: { window: ScaledSize; screen: ScaledSize }) => void
859
): void;
860
}
861
862
interface ScaledSize {
863
width: number;
864
height: number;
865
scale: number;
866
fontScale: number;
867
}
868
869
declare const Dimensions: Dimensions;
870
```
871
872
#### Keyboard
873
874
Keyboard visibility and metrics information.
875
876
```typescript { .api }
877
/**
878
* Keyboard visibility and metrics information
879
*/
880
interface Keyboard {
881
/** Add keyboard event listener */
882
addListener(
883
eventName: 'keyboardDidShow' | 'keyboardDidHide' | 'keyboardWillShow' | 'keyboardWillHide',
884
callback: (event: KeyboardEvent) => void
885
): EventSubscription;
886
/** Remove all listeners for event */
887
removeAllListeners(eventName?: string): void;
888
/** Dismiss active keyboard */
889
dismiss(): void;
890
}
891
892
interface KeyboardEvent {
893
startCoordinates?: ScreenRect;
894
endCoordinates: ScreenRect;
895
duration?: number;
896
easing?: string;
897
}
898
899
interface ScreenRect {
900
screenX: number;
901
screenY: number;
902
width: number;
903
height: number;
904
}
905
906
declare const Keyboard: Keyboard;
907
```
908
909
#### Linking
910
911
URL linking and deep link handling capabilities.
912
913
```typescript { .api }
914
/**
915
* URL linking and deep link handling capabilities
916
*/
917
interface Linking {
918
/** Open URL in default application */
919
openURL(url: string): Promise<void>;
920
/** Check if URL can be handled */
921
canOpenURL(url: string): Promise<boolean>;
922
/** Get initial launch URL */
923
getInitialURL(): Promise<string | null>;
924
/** Add URL change listener */
925
addEventListener(type: 'url', handler: (event: { url: string }) => void): void;
926
/** Remove URL change listener */
927
removeEventListener(type: 'url', handler: (event: { url: string }) => void): void;
928
/** Send intent (Android specific) */
929
sendIntent(action: string, extras?: Array<{ key: string; value: string | number | boolean }>): Promise<void>;
930
}
931
932
declare const Linking: Linking;
933
```
934
935
#### Share
936
937
Native sharing capabilities for content.
938
939
```typescript { .api }
940
/**
941
* Native sharing capabilities for content
942
*/
943
interface Share {
944
/** Share content using native sharing */
945
share(
946
content: ShareContent,
947
options?: ShareOptions
948
): Promise<ShareAction>;
949
}
950
951
interface ShareContent {
952
message?: string;
953
url?: string;
954
title?: string;
955
}
956
957
interface ShareOptions {
958
dialogTitle?: string;
959
excludedActivityTypes?: string[];
960
tintColor?: string;
961
subject?: string;
962
}
963
964
interface ShareAction {
965
action: 'sharedAction' | 'dismissedAction';
966
activityType?: string;
967
}
968
969
declare const Share: Share;
970
```
971
972
#### Vibration
973
974
Haptic feedback and vibration control.
975
976
```typescript { .api }
977
/**
978
* Haptic feedback and vibration control
979
*/
980
interface Vibration {
981
/** Trigger vibration */
982
vibrate(pattern?: number | number[], repeat?: boolean): void;
983
/** Cancel ongoing vibration */
984
cancel(): void;
985
}
986
987
declare const Vibration: Vibration;
988
```
989
990
## Types
991
992
```typescript { .api }
993
// Animation configuration types
994
interface TimingAnimationConfig {
995
toValue: number | AnimatedValue | { x: number; y: number };
996
duration?: number;
997
easing?: (value: number) => number;
998
delay?: number;
999
useNativeDriver?: boolean;
1000
}
1001
1002
interface SpringAnimationConfig {
1003
toValue: number | AnimatedValue | { x: number; y: number };
1004
restDisplacementThreshold?: number;
1005
overshootClamping?: boolean;
1006
restSpeedThreshold?: number;
1007
velocity?: number | { x: number; y: number };
1008
bounciness?: number;
1009
speed?: number;
1010
tension?: number;
1011
friction?: number;
1012
stiffness?: number;
1013
damping?: number;
1014
mass?: number;
1015
delay?: number;
1016
useNativeDriver?: boolean;
1017
}
1018
1019
interface DecayAnimationConfig {
1020
velocity: number | { x: number; y: number };
1021
deceleration?: number;
1022
delay?: number;
1023
useNativeDriver?: boolean;
1024
}
1025
1026
interface CompositeAnimation {
1027
start(callback?: (finished: { finished: boolean }) => void): void;
1028
stop(): void;
1029
reset(): void;
1030
}
1031
1032
interface InterpolationConfig {
1033
inputRange: number[];
1034
outputRange: number[] | string[];
1035
easing?: (value: number) => number;
1036
extrapolate?: 'extend' | 'identity' | 'clamp';
1037
extrapolateLeft?: 'extend' | 'identity' | 'clamp';
1038
extrapolateRight?: 'extend' | 'identity' | 'clamp';
1039
}
1040
1041
// Event listener subscription type
1042
interface EventSubscription {
1043
remove(): void;
1044
}
1045
1046
// Generic animation component type
1047
type AnimatedComponent<T> = T & {
1048
getNode(): T;
1049
};
1050
1051
// Animation listener type
1052
type AnimatedListener = (value: { value: number }) => void;
1053
```