-
-
Notifications
You must be signed in to change notification settings - Fork 643
Expand file tree
/
Copy pathTabsHostIOSNativeComponent.ts
More file actions
91 lines (71 loc) · 2.51 KB
/
TabsHostIOSNativeComponent.ts
File metadata and controls
91 lines (71 loc) · 2.51 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
'use client';
import { codegenNativeComponent } from 'react-native';
import type { CodegenTypes as CT, ColorValue, ViewProps } from 'react-native';
// #region General helpers
type TabSelectedEvent = Readonly<{
selectedScreenKey: string;
provenance: CT.Int32;
isRepeated: boolean;
hasTriggeredSpecialEffect: boolean;
actionOrigin: 'user' | 'programmatic-js' | 'programmatic-native' | 'implicit';
}>;
type NavigationStateRequest = Readonly<{
selectedScreenKey: string;
baseProvenance: CT.Int32;
}>;
type TabSelectionRejectedEvent = Readonly<{
selectedScreenKey: string;
provenance: CT.Int32;
rejectedScreenKey: string;
rejectedProvenance: CT.Int32;
rejectionReason: 'stale' | 'repeated';
}>;
type TabSelectionPreventedEvent = Readonly<{
selectedScreenKey: string;
provenance: CT.Int32;
preventedScreenKey: string;
}>;
type MoreTabSelectedEvent = Readonly<{
selectedScreenKey: string;
provenance: CT.Int32;
}>;
type TabsHostColorScheme = 'inherit' | 'light' | 'dark';
type LayoutDirection = 'inherit' | 'ltr' | 'rtl';
// #endregion General helpers
// #region iOS-specific helpers
type TabBarMinimizeBehavior =
| 'automatic'
| 'never'
| 'onScrollDown'
| 'onScrollUp';
type TabBarControllerMode = 'automatic' | 'tabBar' | 'tabSidebar';
// #endregion iOS-specific helpers
export interface NativeProps extends ViewProps {
// Control
navStateRequest: NavigationStateRequest;
rejectStaleNavStateUpdates?: CT.WithDefault<boolean, false>;
// Events
onTabSelected?: CT.DirectEventHandler<TabSelectedEvent> | undefined;
onTabSelectionRejected?:
| CT.DirectEventHandler<TabSelectionRejectedEvent>
| undefined;
onTabSelectionPrevented?:
| CT.DirectEventHandler<TabSelectionPreventedEvent>
| undefined;
onMoreTabSelected?: CT.DirectEventHandler<MoreTabSelectedEvent> | undefined;
// General
tabBarHidden?: CT.WithDefault<boolean, false>;
nativeContainerBackgroundColor?: ColorValue | undefined;
colorScheme?: CT.WithDefault<TabsHostColorScheme, 'inherit'>;
// We can't use `direction` name for this prop as it's also used by
// direction style View prop.
layoutDirection?: CT.WithDefault<LayoutDirection, 'inherit'>;
// iOS-specific props
tabBarTintColor?: ColorValue | undefined;
tabBarMinimizeBehavior?: CT.WithDefault<TabBarMinimizeBehavior, 'automatic'>;
tabBarControllerMode?: CT.WithDefault<TabBarControllerMode, 'automatic'>;
}
export default codegenNativeComponent<NativeProps>('RNSTabsHostIOS', {
interfaceOnly: true,
excludedPlatforms: ['android'],
});