|
5 | 5 | * LICENSE file in the root directory of this source tree.
|
6 | 6 | *
|
7 | 7 | * @flow
|
8 |
| - * @format |
9 | 8 | */
|
10 | 9 | 'use strict';
|
11 | 10 |
|
12 | 11 | import {requireNativeComponent} from 'react-native';
|
13 |
| - |
14 |
| -import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes'; |
15 |
| -import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes'; |
16 | 12 | import type {NativeComponent} from 'react-native/Libraries/Renderer/shims/ReactNative';
|
17 |
| -import type {ColorValue} from 'react-native/Libraries/StyleSheet/StyleSheetTypes'; |
18 |
| - |
19 |
| -type Event = SyntheticEvent< |
20 |
| - $ReadOnly<{| |
21 |
| - value: number, |
22 |
| - selectedSegmentIndex: number, |
23 |
| - |}>, |
24 |
| ->; |
25 |
| - |
26 |
| -export type SegmentedControlIOSProps = $ReadOnly<{| |
27 |
| - ...ViewProps, |
28 |
| - /** |
29 |
| - * The labels for the control's segment buttons, in order. |
30 |
| - */ |
31 |
| - values?: $ReadOnlyArray<string>, |
32 |
| - /** |
33 |
| - * The index in `props.values` of the segment to be (pre)selected. |
34 |
| - */ |
35 |
| - selectedIndex?: ?number, |
36 |
| - /** |
37 |
| - * Callback that is called when the user taps a segment; |
38 |
| - * passes the segment's value as an argument |
39 |
| - */ |
40 |
| - onValueChange?: ?(value: number) => mixed, |
41 |
| - /** |
42 |
| - * Callback that is called when the user taps a segment; |
43 |
| - * passes the event as an argument |
44 |
| - */ |
45 |
| - onChange?: ?(event: Event) => mixed, |
46 |
| - /** |
47 |
| - * If false the user won't be able to interact with the control. |
48 |
| - * Default value is true. |
49 |
| - */ |
50 |
| - enabled?: boolean, |
51 |
| - /** |
52 |
| - * Accent color of the control. |
53 |
| - */ |
54 |
| - tintColor?: ?ColorValue, |
55 |
| - /** |
56 |
| - * Text color of the control. |
57 |
| - * NOTE: this prop will only work for iOS >= 13 |
58 |
| - */ |
59 |
| - textColor?: ?ColorValue, |
60 |
| - /** |
61 |
| - * Text color of the control when selected. |
62 |
| - * NOTE: this prop will only work for iOS >= 13 |
63 |
| - */ |
64 |
| - activeTextColor?: ?ColorValue, |
65 |
| - /** |
66 |
| - * Background color of the control. |
67 |
| - * NOTE: this prop will only work for iOS >= 13 |
68 |
| - */ |
69 |
| - backgroundColor?: ?ColorValue, |
70 |
| - /** |
71 |
| - * If true, then selecting a segment won't persist visually. |
72 |
| - * The `onValueChange` callback will still work as expected. |
73 |
| - */ |
74 |
| - momentary?: ?boolean, |
75 |
| - /** |
76 |
| - * (iOS 13 only) |
77 |
| - * Overrides the control's appearance irrespective of the OS theme |
78 |
| - */ |
79 |
| - appearance?: 'dark' | 'light', |
80 |
| -|}>; |
| 13 | +import type {SegmentedControlProps} from './types'; |
81 | 14 |
|
82 |
| -type NativeSegmentedControlIOS = Class< |
83 |
| - NativeComponent<SegmentedControlIOSProps>, |
84 |
| ->; |
| 15 | +type NativeSegmentedControlIOS = Class<NativeComponent<SegmentedControlProps>>; |
85 | 16 |
|
86 | 17 | module.exports = ((requireNativeComponent(
|
87 | 18 | 'RNCSegmentedControl',
|
|
0 commit comments