Skip to content

Commit

Permalink
feat: Dialog blur event callback suopport clickIncludeElm
Browse files Browse the repository at this point in the history
  • Loading branch information
myxvisual committed Nov 17, 2017
1 parent 74f5a1a commit 695ab87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Dialog/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ export class Dialog extends React.Component<DialogProps, DialogState> {
static defaultProps: DialogProps = {
contentEnterStyle: { transform: "scale(1)" },
contentLeaveStyle: { transform: "scale(0)" }
}
};
state: DialogState = {
showDialog: this.props.defaultShow
};

static contextTypes = { theme: PropTypes.object };
context: { theme: ReactUWP.ThemeType };
renderToBody: RenderToBody;
rootElm: HTMLDivElement;
addBlurEvent = new AddBlurEvent();

Expand Down Expand Up @@ -84,7 +85,7 @@ export class Dialog extends React.Component<DialogProps, DialogState> {
const { onCloseDialog, isControlled } = this.props;
this.addBlurEvent.setConfig({
addListener: this.state.showDialog,
clickExcludeElm: this.rootElm,
clickIncludeElm: this.renderToBody.rootElm,
blurCallback: () => {
if (isControlled) return;
this.setState({
Expand Down Expand Up @@ -120,6 +121,7 @@ export class Dialog extends React.Component<DialogProps, DialogState> {
<RenderToBody
{...attributes}
style={styles.root.style}
ref={renderToBody => this.renderToBody = renderToBody}
className={theme.classNames(styles.root.className, className)}
>
<div ref={rootElm => this.rootElm = rootElm} {...styles.content}>
Expand Down
1 change: 1 addition & 0 deletions src/Slider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export class Slider extends React.Component<SliderProps, SliderState> {
onChangedValue,
onChangeValueRatio
} = this.props;

const isHorizonMode = displayMode === "horizon";
const useCustomBackground = barBackground || barBackgroundImage;
const { left, width, bottom, height } = this.rootElm.getBoundingClientRect();
Expand Down

0 comments on commit 695ab87

Please sign in to comment.