-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix TS issue and update generate types
- Loading branch information
Showing
6 changed files
with
336 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters