Skip to content

Commit

Permalink
Merge pull request #168 from xiaoTuiMao/xiaoTuiMao/use-window-after-o…
Browse files Browse the repository at this point in the history
…nload

-serverside rendering bug
  • Loading branch information
n7best committed Dec 20, 2016
2 parents fdfe2a1 + e9dd4d2 commit b80d442
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
14 changes: 10 additions & 4 deletions src/components/actionsheet/actionsheet.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
import Mask from '../mask/index';
import { isAndroid } from '../../utils/mobile_detect';
import './actionsheet.less';

/**
Expand Down Expand Up @@ -51,8 +50,8 @@ class ActionSheet extends Component {
super(props);

this.state = {
isAndroid: isAndroid
}
isAndroid: ''
};

this.handleMaskClick = this.handleMaskClick.bind(this)
}
Expand Down Expand Up @@ -89,6 +88,13 @@ class ActionSheet extends Component {
if(this.props.onRequestClose) this.props.onRequestClose(e)
}

componentDidMount(){
const { isAndroid } = require('../../utils/mobile_detect');
this.setState({
isAndroid,
});
}

render() {
const {show, autoDectect, type, onRequestClose, menus, actions, ...others} = this.props;
const cls = classNames({
Expand Down Expand Up @@ -120,4 +126,4 @@ class ActionSheet extends Component {
}
};

export default ActionSheet;
export default ActionSheet;
12 changes: 9 additions & 3 deletions src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { Component, PropTypes } from 'react';
import classNames from 'classnames';
import Mask from '../mask/index';
import { isAndroid } from '../../utils/mobile_detect';

/**
* Modals provide feedback to user
Expand Down Expand Up @@ -48,7 +47,7 @@ class Dialog extends Component {
super(props)

this.state = {
isAndroid: isAndroid
isAndroid: ''
}
}

Expand All @@ -67,6 +66,13 @@ class Dialog extends Component {
});
}

componentDidMount(){
const { isAndroid } = require('../../utils/mobile_detect');
this.setState({
isAndroid,
});
}

render() {
const {title, show, className, children, buttons, type, autoDectect, ...others} = this.props;
const styleType = type ? type : 'ios';
Expand Down Expand Up @@ -95,4 +101,4 @@ class Dialog extends Component {
}
}

export default Dialog;
export default Dialog;

0 comments on commit b80d442

Please sign in to comment.