Skip to content

Commit af93963

Browse files
committed
Fix TS issue and update generate types
1 parent 36a60ec commit af93963

File tree

6 files changed

+336
-1
lines changed

6 files changed

+336
-1
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import React from 'react';
2+
import { StyleProp, ViewStyle } from 'react-native';
3+
import { DialogProps } from '../dialog';
4+
import { ButtonProps } from '../button';
5+
declare type ActionSheetOnOptionPress = (index: number) => void;
6+
declare type ActionSheetProps = {
7+
/**
8+
* Whether to show the action sheet or not
9+
*/
10+
visible: boolean;
11+
/**
12+
* Title of the action sheet. Note: if both title and message are not passed will not render the title view at all
13+
*/
14+
title?: string;
15+
/**
16+
* Message of the action sheet
17+
*/
18+
message?: string;
19+
/**
20+
* Index of the option represents the cancel action (to be displayed as the separated bottom bold button)
21+
*/
22+
cancelButtonIndex?: number;
23+
/**
24+
* Index of the option represents the destructive action (will display red text. Usually used for 'delete' or
25+
* 'abort' actions)
26+
*/
27+
destructiveButtonIndex?: number;
28+
/**
29+
* List of options for the action sheet, follows the Button prop types (supply 'label' string and 'onPress'
30+
* function)
31+
*/
32+
options?: Array<ButtonProps>;
33+
/**
34+
* callback for when dismissing the action sheet, usually used for setting visible prop to false
35+
*/
36+
onDismiss?: DialogProps['onDismiss'];
37+
/**
38+
* Should use the native action sheet for iOS
39+
*/
40+
useNativeIOS?: boolean;
41+
/**
42+
* When passed (only with useNativeIOS), will display a cancel button at the bottom (overrides cancelButtonIndex)
43+
*/
44+
showCancelButton?: boolean;
45+
/**
46+
* Add or override style of the action sheet (wraps the title and actions)
47+
*/
48+
containerStyle?: StyleProp<ViewStyle>;
49+
/**
50+
* Add or override style of the dialog wrapping the action sheet
51+
*/
52+
dialogStyle?: StyleProp<ViewStyle>;
53+
/**
54+
* Add or override style of the options list
55+
*/
56+
optionsStyle?: StyleProp<ViewStyle>;
57+
/**
58+
* Render custom title
59+
*/
60+
renderTitle?: () => JSX.Element;
61+
/**
62+
* Render custom action
63+
* Note: you will need to call onOptionPress so the option's onPress will be called
64+
*/
65+
renderAction?: (option: ButtonProps, index: number, onOptionPress: ActionSheetOnOptionPress) => JSX.Element;
66+
/**
67+
* Called once the modal has been dismissed (iOS only, modal only)
68+
*/
69+
onModalDismissed?: DialogProps['onModalDismissed'];
70+
/**
71+
* Whether or not to handle SafeArea
72+
*/
73+
useSafeArea?: boolean;
74+
/**
75+
* testID for e2e tests
76+
*/
77+
testID?: string;
78+
};
79+
declare const _default: React.ComponentClass<ActionSheetProps & {
80+
useCustomTheme?: boolean | undefined;
81+
}, any>;
82+
export default _default;
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
import React, { Component, ElementRef } from 'react';
2+
import { Animated, StyleProp, TextStyle, TouchableWithoutFeedbackProps, LayoutChangeEvent } from 'react-native';
3+
import { ButtonProps } from '../button';
4+
import { PageControlProps } from '../pageControl';
5+
export declare type HighlightFrame = {
6+
x: number;
7+
y: number;
8+
width: number;
9+
height: number;
10+
};
11+
declare type RectSize = {
12+
width: number;
13+
height: number;
14+
};
15+
declare type Position = {
16+
left: number;
17+
top: number;
18+
width: number;
19+
height: number;
20+
};
21+
export declare type FeatureHighlightProps = {
22+
/**
23+
* Boolean to determine if to present the feature highlight component
24+
*/
25+
visible: boolean;
26+
/**
27+
* Frame of the area to highlight {x, y, width, height}
28+
*/
29+
highlightFrame?: HighlightFrame;
30+
/**
31+
* Callback that extract the ref of the element to be highlighted
32+
*/
33+
getTarget?: () => any;
34+
/**
35+
* Title of the content to be displayed
36+
*/
37+
title?: string;
38+
/**
39+
* Message to be displayed
40+
*/
41+
message?: string;
42+
/**
43+
* Title text style
44+
*/
45+
titleStyle?: StyleProp<TextStyle>;
46+
/**
47+
* Message text style
48+
*/
49+
messageStyle?: StyleProp<TextStyle>;
50+
/**
51+
* Title's max number of lines
52+
*/
53+
titleNumberOfLines?: number;
54+
/**
55+
* Message's max number of lines
56+
*/
57+
messageNumberOfLines?: number;
58+
/**
59+
* Props that will be passed to the dismiss button
60+
*/
61+
confirmButtonProps?: ButtonProps;
62+
/**
63+
* Callback for the background press
64+
*/
65+
onBackgroundPress?: TouchableWithoutFeedbackProps['onPress'];
66+
/**
67+
* Color of the content's background (usually includes alpha for transparency)
68+
*/
69+
overlayColor?: string;
70+
/**
71+
* Color of the content's text
72+
*/
73+
textColor?: string;
74+
/**
75+
* Color of the border around the highlighted element
76+
*/
77+
borderColor?: string;
78+
/**
79+
* Width of the border around the highlighted element
80+
*/
81+
borderWidth?: number;
82+
/**
83+
* Border radius for the border corners around the highlighted element
84+
*/
85+
borderRadius?: number;
86+
/**
87+
* The minimum size of the highlighted component (Android API 21+, and only when passing a ref in 'getTarget')
88+
*/
89+
minimumRectSize?: RectSize;
90+
/**
91+
* The padding of the highlight frame around the highlighted element's frame (only when passing ref in 'getTarget')
92+
*/
93+
innerPadding?: number;
94+
/**
95+
* PageControl component's props
96+
*/
97+
pageControlProps?: PageControlProps;
98+
testID?: string;
99+
};
100+
interface State {
101+
fadeAnim: Animated.Value;
102+
contentTopPosition?: number;
103+
node?: number | null;
104+
getTarget?: () => any;
105+
}
106+
/**
107+
* @description: FeatureHighlight component for feature discovery
108+
* @notes: 1) FeatureHighlight component must be a direct child of the root view returned in render().; 2) If the element to be highlighted doesn't have a style attribute add 'style={{opacity: 1}}' so the Android OS can detect it.
109+
* @important: FeatureHighlight uses a native library. You MUST add and link the native library to both iOS and Android projects. For instruction please see
110+
* @importantLink: https://facebook.github.io/react-native/docs/linking-libraries-ios.html
111+
* @extends: HighlighterOverlayView
112+
* @extendsLink: docs/HighlighterOverlayView
113+
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/FeatureHighlight/FeatureHighlight.gif?raw=true
114+
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/FeatureHighlightScreen.js
115+
*/
116+
declare class FeatureHighlight extends Component<FeatureHighlightProps, State> {
117+
static displayName: string;
118+
contentHeight: number;
119+
targetPosition?: Position;
120+
viewRef?: ElementRef<any>;
121+
constructor(props: FeatureHighlightProps);
122+
static defaultProps: {
123+
minimumRectSize: {
124+
width: number;
125+
height: number;
126+
};
127+
innerPadding: number;
128+
};
129+
componentDidMount(): void;
130+
static getDerivedStateFromProps(nextProps: FeatureHighlightProps, prevState: State): {
131+
getTarget: (() => any) | undefined;
132+
node: number;
133+
} | null;
134+
shouldSetTargetPosition: (nextProps: FeatureHighlightProps) => boolean;
135+
componentDidUpdate(nextProps: FeatureHighlightProps): void;
136+
setAccessibilityFocus(ref: any): void;
137+
static findTargetNode(target: Component): number | null;
138+
animate(toValue: number): void;
139+
setTargetPosition(props?: Readonly<FeatureHighlightProps> & Readonly<{
140+
children?: React.ReactNode;
141+
}>): void;
142+
getContentPosition(): number;
143+
setContentPosition(): void;
144+
getComponentDimensions(event: LayoutChangeEvent): void;
145+
onPress: () => void;
146+
renderHighlightMessage(): JSX.Element;
147+
render(): JSX.Element | null;
148+
}
149+
export { FeatureHighlight as testable };
150+
declare const _default: React.ComponentClass<FeatureHighlightProps & {
151+
useCustomTheme?: boolean | undefined;
152+
}, any> & typeof FeatureHighlight;
153+
export default _default;
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import React from 'react';
2+
import { StyleProp, ViewStyle } from 'react-native';
3+
import { ViewProps } from '../view';
4+
import { ButtonProps } from '../button';
5+
export declare type StackAggregatorProps = ViewProps & {
6+
/**
7+
* The initial state of the stack
8+
*/
9+
collapsed: boolean;
10+
/**
11+
* Component Children
12+
*/
13+
children: JSX.Element | JSX.Element[];
14+
/**
15+
* The container style
16+
*/
17+
containerStyle?: StyleProp<ViewStyle>;
18+
/**
19+
* The content container style
20+
*/
21+
contentContainerStyle?: StyleProp<ViewStyle>;
22+
/**
23+
* The items border radius
24+
*/
25+
itemBorderRadius?: number;
26+
/**
27+
* Props passed to the 'show less' button
28+
*/
29+
buttonProps?: ButtonProps;
30+
/**
31+
* A callback for item press
32+
*/
33+
onItemPress?: (index: number) => void;
34+
/**
35+
* A callback for collapse state will change (value is future collapsed state)
36+
*/
37+
onCollapseWillChange?: (changed: boolean) => void;
38+
/**
39+
* A callback for collapse state change (value is collapsed state)
40+
*/
41+
onCollapseChanged?: (changed: boolean) => void;
42+
/**
43+
* A setting that disables pressability on cards
44+
*/
45+
disablePresses?: boolean;
46+
};
47+
declare const _default: React.ComponentClass<ViewProps & {
48+
/**
49+
* The initial state of the stack
50+
*/
51+
collapsed: boolean;
52+
/**
53+
* Component Children
54+
*/
55+
children: JSX.Element | JSX.Element[];
56+
/**
57+
* The container style
58+
*/
59+
containerStyle?: StyleProp<ViewStyle>;
60+
/**
61+
* The content container style
62+
*/
63+
contentContainerStyle?: StyleProp<ViewStyle>;
64+
/**
65+
* The items border radius
66+
*/
67+
itemBorderRadius?: number | undefined;
68+
/**
69+
* Props passed to the 'show less' button
70+
*/
71+
buttonProps?: ButtonProps | undefined;
72+
/**
73+
* A callback for item press
74+
*/
75+
onItemPress?: ((index: number) => void) | undefined;
76+
/**
77+
* A callback for collapse state will change (value is future collapsed state)
78+
*/
79+
onCollapseWillChange?: ((changed: boolean) => void) | undefined;
80+
/**
81+
* A callback for collapse state change (value is collapsed state)
82+
*/
83+
onCollapseChanged?: ((changed: boolean) => void) | undefined;
84+
/**
85+
* A setting that disables pressability on cards
86+
*/
87+
disablePresses?: boolean | undefined;
88+
} & {
89+
useCustomTheme?: boolean | undefined;
90+
}, any>;
91+
export default _default;

generatedTypes/components/tabController/TabBar.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ export interface TabControllerBarProps {
7979
* Additional styles for the container
8080
*/
8181
containerStyle?: StyleProp<ViewStyle>;
82+
/**
83+
* Additional styles for the ScrollView
84+
*/
85+
scrollViewStyle?: StyleProp<ViewStyle>;
8286
/**
8387
* Used as a testing identifier
8488
*/

generatedTypes/components/tabController/TabBarItem.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,10 @@ export interface TabControllerItemProps {
8080
* Used as a testing identifier
8181
*/
8282
testID?: string;
83+
/**
84+
* disables icon's tint color
85+
*/
86+
disableIconTintColor?: boolean;
8387
}
8488
interface Props extends TabControllerItemProps {
8589
index: number;
@@ -108,7 +112,7 @@ export default class TabBarItem extends PureComponent<Props> {
108112
getLabelStyle(): (TextStyle | _.Dictionary<Reanimated.Node<number> | Reanimated.Node<string | number | boolean> | Reanimated.Node<"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"> | undefined> | undefined)[];
109113
getIconStyle(): {
110114
tintColor: Reanimated.Node<string>;
111-
};
115+
} | undefined;
112116
render(): JSX.Element;
113117
}
114118
export {};

src/components/featureHighlight/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import View from '../view';
1818
import Text from '../text';
1919
import Button, {ButtonProps, ButtonSize} from '../button';
2020
import PageControl, {PageControlProps} from '../pageControl';
21+
//@ts-expect-error
2122
import {HighlighterOverlayView} from '../../nativeComponents';
2223

2324
const defaultOverlayColor = Colors.rgba(Colors.black, 0.82);

0 commit comments

Comments
 (0)