Skip to content

Commit

Permalink
Fix TS issue and update generate types
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanshar committed Jun 9, 2021
1 parent 36a60ec commit af93963
Show file tree
Hide file tree
Showing 6 changed files with 336 additions and 1 deletion.
82 changes: 82 additions & 0 deletions generatedTypes/components/actionSheet/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import React from 'react';
import { StyleProp, ViewStyle } from 'react-native';
import { DialogProps } from '../dialog';
import { ButtonProps } from '../button';
declare type ActionSheetOnOptionPress = (index: number) => void;
declare type ActionSheetProps = {
/**
* Whether to show the action sheet or not
*/
visible: boolean;
/**
* Title of the action sheet. Note: if both title and message are not passed will not render the title view at all
*/
title?: string;
/**
* Message of the action sheet
*/
message?: string;
/**
* Index of the option represents the cancel action (to be displayed as the separated bottom bold button)
*/
cancelButtonIndex?: number;
/**
* Index of the option represents the destructive action (will display red text. Usually used for 'delete' or
* 'abort' actions)
*/
destructiveButtonIndex?: number;
/**
* List of options for the action sheet, follows the Button prop types (supply 'label' string and 'onPress'
* function)
*/
options?: Array<ButtonProps>;
/**
* callback for when dismissing the action sheet, usually used for setting visible prop to false
*/
onDismiss?: DialogProps['onDismiss'];
/**
* Should use the native action sheet for iOS
*/
useNativeIOS?: boolean;
/**
* When passed (only with useNativeIOS), will display a cancel button at the bottom (overrides cancelButtonIndex)
*/
showCancelButton?: boolean;
/**
* Add or override style of the action sheet (wraps the title and actions)
*/
containerStyle?: StyleProp<ViewStyle>;
/**
* Add or override style of the dialog wrapping the action sheet
*/
dialogStyle?: StyleProp<ViewStyle>;
/**
* Add or override style of the options list
*/
optionsStyle?: StyleProp<ViewStyle>;
/**
* Render custom title
*/
renderTitle?: () => JSX.Element;
/**
* Render custom action
* Note: you will need to call onOptionPress so the option's onPress will be called
*/
renderAction?: (option: ButtonProps, index: number, onOptionPress: ActionSheetOnOptionPress) => JSX.Element;
/**
* Called once the modal has been dismissed (iOS only, modal only)
*/
onModalDismissed?: DialogProps['onModalDismissed'];
/**
* Whether or not to handle SafeArea
*/
useSafeArea?: boolean;
/**
* testID for e2e tests
*/
testID?: string;
};
declare const _default: React.ComponentClass<ActionSheetProps & {
useCustomTheme?: boolean | undefined;
}, any>;
export default _default;
153 changes: 153 additions & 0 deletions generatedTypes/components/featureHighlight/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
import React, { Component, ElementRef } from 'react';
import { Animated, StyleProp, TextStyle, TouchableWithoutFeedbackProps, LayoutChangeEvent } from 'react-native';
import { ButtonProps } from '../button';
import { PageControlProps } from '../pageControl';
export declare type HighlightFrame = {
x: number;
y: number;
width: number;
height: number;
};
declare type RectSize = {
width: number;
height: number;
};
declare type Position = {
left: number;
top: number;
width: number;
height: number;
};
export declare type FeatureHighlightProps = {
/**
* Boolean to determine if to present the feature highlight component
*/
visible: boolean;
/**
* Frame of the area to highlight {x, y, width, height}
*/
highlightFrame?: HighlightFrame;
/**
* Callback that extract the ref of the element to be highlighted
*/
getTarget?: () => any;
/**
* Title of the content to be displayed
*/
title?: string;
/**
* Message to be displayed
*/
message?: string;
/**
* Title text style
*/
titleStyle?: StyleProp<TextStyle>;
/**
* Message text style
*/
messageStyle?: StyleProp<TextStyle>;
/**
* Title's max number of lines
*/
titleNumberOfLines?: number;
/**
* Message's max number of lines
*/
messageNumberOfLines?: number;
/**
* Props that will be passed to the dismiss button
*/
confirmButtonProps?: ButtonProps;
/**
* Callback for the background press
*/
onBackgroundPress?: TouchableWithoutFeedbackProps['onPress'];
/**
* Color of the content's background (usually includes alpha for transparency)
*/
overlayColor?: string;
/**
* Color of the content's text
*/
textColor?: string;
/**
* Color of the border around the highlighted element
*/
borderColor?: string;
/**
* Width of the border around the highlighted element
*/
borderWidth?: number;
/**
* Border radius for the border corners around the highlighted element
*/
borderRadius?: number;
/**
* The minimum size of the highlighted component (Android API 21+, and only when passing a ref in 'getTarget')
*/
minimumRectSize?: RectSize;
/**
* The padding of the highlight frame around the highlighted element's frame (only when passing ref in 'getTarget')
*/
innerPadding?: number;
/**
* PageControl component's props
*/
pageControlProps?: PageControlProps;
testID?: string;
};
interface State {
fadeAnim: Animated.Value;
contentTopPosition?: number;
node?: number | null;
getTarget?: () => any;
}
/**
* @description: FeatureHighlight component for feature discovery
* @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.
* @important: FeatureHighlight uses a native library. You MUST add and link the native library to both iOS and Android projects. For instruction please see
* @importantLink: https://facebook.github.io/react-native/docs/linking-libraries-ios.html
* @extends: HighlighterOverlayView
* @extendsLink: docs/HighlighterOverlayView
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/FeatureHighlight/FeatureHighlight.gif?raw=true
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/FeatureHighlightScreen.js
*/
declare class FeatureHighlight extends Component<FeatureHighlightProps, State> {
static displayName: string;
contentHeight: number;
targetPosition?: Position;
viewRef?: ElementRef<any>;
constructor(props: FeatureHighlightProps);
static defaultProps: {
minimumRectSize: {
width: number;
height: number;
};
innerPadding: number;
};
componentDidMount(): void;
static getDerivedStateFromProps(nextProps: FeatureHighlightProps, prevState: State): {
getTarget: (() => any) | undefined;
node: number;
} | null;
shouldSetTargetPosition: (nextProps: FeatureHighlightProps) => boolean;
componentDidUpdate(nextProps: FeatureHighlightProps): void;
setAccessibilityFocus(ref: any): void;
static findTargetNode(target: Component): number | null;
animate(toValue: number): void;
setTargetPosition(props?: Readonly<FeatureHighlightProps> & Readonly<{
children?: React.ReactNode;
}>): void;
getContentPosition(): number;
setContentPosition(): void;
getComponentDimensions(event: LayoutChangeEvent): void;
onPress: () => void;
renderHighlightMessage(): JSX.Element;
render(): JSX.Element | null;
}
export { FeatureHighlight as testable };
declare const _default: React.ComponentClass<FeatureHighlightProps & {
useCustomTheme?: boolean | undefined;
}, any> & typeof FeatureHighlight;
export default _default;
91 changes: 91 additions & 0 deletions generatedTypes/components/stackAggregator/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React from 'react';
import { StyleProp, ViewStyle } from 'react-native';
import { ViewProps } from '../view';
import { ButtonProps } from '../button';
export declare type StackAggregatorProps = ViewProps & {
/**
* The initial state of the stack
*/
collapsed: boolean;
/**
* Component Children
*/
children: JSX.Element | JSX.Element[];
/**
* The container style
*/
containerStyle?: StyleProp<ViewStyle>;
/**
* The content container style
*/
contentContainerStyle?: StyleProp<ViewStyle>;
/**
* The items border radius
*/
itemBorderRadius?: number;
/**
* Props passed to the 'show less' button
*/
buttonProps?: ButtonProps;
/**
* A callback for item press
*/
onItemPress?: (index: number) => void;
/**
* A callback for collapse state will change (value is future collapsed state)
*/
onCollapseWillChange?: (changed: boolean) => void;
/**
* A callback for collapse state change (value is collapsed state)
*/
onCollapseChanged?: (changed: boolean) => void;
/**
* A setting that disables pressability on cards
*/
disablePresses?: boolean;
};
declare const _default: React.ComponentClass<ViewProps & {
/**
* The initial state of the stack
*/
collapsed: boolean;
/**
* Component Children
*/
children: JSX.Element | JSX.Element[];
/**
* The container style
*/
containerStyle?: StyleProp<ViewStyle>;
/**
* The content container style
*/
contentContainerStyle?: StyleProp<ViewStyle>;
/**
* The items border radius
*/
itemBorderRadius?: number | undefined;
/**
* Props passed to the 'show less' button
*/
buttonProps?: ButtonProps | undefined;
/**
* A callback for item press
*/
onItemPress?: ((index: number) => void) | undefined;
/**
* A callback for collapse state will change (value is future collapsed state)
*/
onCollapseWillChange?: ((changed: boolean) => void) | undefined;
/**
* A callback for collapse state change (value is collapsed state)
*/
onCollapseChanged?: ((changed: boolean) => void) | undefined;
/**
* A setting that disables pressability on cards
*/
disablePresses?: boolean | undefined;
} & {
useCustomTheme?: boolean | undefined;
}, any>;
export default _default;
4 changes: 4 additions & 0 deletions generatedTypes/components/tabController/TabBar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ export interface TabControllerBarProps {
* Additional styles for the container
*/
containerStyle?: StyleProp<ViewStyle>;
/**
* Additional styles for the ScrollView
*/
scrollViewStyle?: StyleProp<ViewStyle>;
/**
* Used as a testing identifier
*/
Expand Down
6 changes: 5 additions & 1 deletion generatedTypes/components/tabController/TabBarItem.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export interface TabControllerItemProps {
* Used as a testing identifier
*/
testID?: string;
/**
* disables icon's tint color
*/
disableIconTintColor?: boolean;
}
interface Props extends TabControllerItemProps {
index: number;
Expand Down Expand Up @@ -108,7 +112,7 @@ export default class TabBarItem extends PureComponent<Props> {
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)[];
getIconStyle(): {
tintColor: Reanimated.Node<string>;
};
} | undefined;
render(): JSX.Element;
}
export {};
1 change: 1 addition & 0 deletions src/components/featureHighlight/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import View from '../view';
import Text from '../text';
import Button, {ButtonProps, ButtonSize} from '../button';
import PageControl, {PageControlProps} from '../pageControl';
//@ts-expect-error
import {HighlighterOverlayView} from '../../nativeComponents';

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

0 comments on commit af93963

Please sign in to comment.