Skip to content

Commit

Permalink
fix(components): 移除 iPhone X的判断逻辑 close #206
Browse files Browse the repository at this point in the history
  • Loading branch information
SzHeJason committed Nov 29, 2018
1 parent 6543725 commit 79ba5b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 34 deletions.
15 changes: 1 addition & 14 deletions src/components/action-sheet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export default class AtActionSheet extends AtComponent {
const { isOpened } = props

this.state = {
isIPhoneX: false,
_isOpened: isOpened
}
}
Expand All @@ -35,17 +34,6 @@ export default class AtActionSheet extends AtComponent {
}
}

componentDidMount () {
const curEnv = Taro.getEnv()

if (
curEnv === Taro.ENV_TYPE.WEAPP &&
Taro.getSystemInfoSync().model.indexOf('iPhone X') >= 0
) {
this.setState({ isIPhoneX: true })
}
}

handleClose = () => {
if (_isFunction(this.props.onClose)) {
this.props.onClose()
Expand Down Expand Up @@ -74,13 +62,12 @@ export default class AtActionSheet extends AtComponent {

render () {
const { title, cancelText, className } = this.props
const { _isOpened, isIPhoneX } = this.state
const { _isOpened } = this.state

const rootClass = classNames(
'at-action-sheet',
{
'at-action-sheet--active': _isOpened,
'at-action-sheet--ipx': isIPhoneX
},
className
)
Expand Down
6 changes: 3 additions & 3 deletions src/components/action-sheet/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ $action-sheet-timer: 300ms;
transition: transform $action-sheet-timer $timing-func;
}

&--ipx &__container {
padding-bottom: 68px;
}
// &--ipx &__container {
// padding-bottom: 68px;
// }
}

.at-action-sheet--active {
Expand Down
34 changes: 17 additions & 17 deletions src/components/tab-bar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,23 @@ export default class AtTabBar extends AtComponent {
onClick: PropTypes.func
}

constructor () {
super(...arguments)
this.state = {
isIPhoneX: false
}
}
// constructor () {
// super(...arguments)
// this.state = {
// isIPhoneX: false
// }
// }

componentDidMount () {
const curEnv = Taro.getEnv()
// componentDidMount () {
// const curEnv = Taro.getEnv()

if (
curEnv === Taro.ENV_TYPE.WEAPP &&
Taro.getSystemInfoSync().model.indexOf('iPhone X') >= 0
) {
this.setState({ isIPhoneX: true })
}
}
// if (
// curEnv === Taro.ENV_TYPE.WEAPP &&
// Taro.getSystemInfoSync().model.indexOf('iPhone X') >= 0
// ) {
// this.setState({ isIPhoneX: true })
// }
// }

handleClick () {
this.props.onClick(...arguments)
Expand All @@ -80,7 +80,7 @@ export default class AtTabBar extends AtComponent {
fontSize,
selectedColor
} = this.props
const { isIPhoneX } = this.state
// const { isIPhoneX } = this.state
const defaultStyle = `color: ${color};`
const selectedStyle = `color: ${selectedColor};`
const titleStyle = `font-size: ${fontSize}px;`
Expand All @@ -92,7 +92,7 @@ export default class AtTabBar extends AtComponent {
classNames({
'at-tab-bar': true,
'at-tab-bar--fixed': fixed,
'at-tab-bar--ipx': isIPhoneX
// 'at-tab-bar--ipx': isIPhoneX
}, className)
}
style={this.mergeStyle(rootStyle, customStyle)}
Expand Down

0 comments on commit 79ba5b0

Please sign in to comment.