Skip to content

Commit

Permalink
ver. 0.3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
qili.taoqili committed Dec 12, 2019
1 parent 401d33f commit 5348566
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uxcore-badge",
"version": "0.3.12",
"version": "0.3.13",
"description": "uxcore-badge component for uxcore.",
"repository": "https://github.com/uxcore/uxcore-badge.git",
"author": "eternalsky",
Expand Down
34 changes: 26 additions & 8 deletions src/ScrollNumber.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,29 @@ import classnames from 'classnames';
import { isCssAnimationSupported } from 'css-animation';
import { polyfill } from 'react-lifecycles-compat';

const isIE = document.documentMode || !!window["ActiveXObject"] ||
"ActiveXObject" in window || navigator.userAgent.indexOf('Edge') !== -1

const renderNumberList = position => {
const childrenToReturn = [];
for (let i = 0; i < 30; i++) {
const currentClassName = position === i ? 'current' : null;
childrenToReturn.push(
<p key={i} className={currentClassName}>
{i % 10}
</p>
);
if (isIE) {
if (position === i) {
childrenToReturn.push(
<p key={i}>
{i % 10}
</p>
)
break
}
} else {
const currentClassName = position === i ? 'current' : null;
childrenToReturn.push(
<p key={i} className={currentClassName}>
{i % 10}
</p>
);
}
}
return childrenToReturn;
};
Expand Down Expand Up @@ -104,14 +118,18 @@ class ScrollNumber extends React.Component {
const removeTransition =
this.state.animateStarted ||
getNumberArray(this.state.lastCount)[i] === undefined;
const transformStyle = {};
if (!isIE) {
transformStyle.WebkitTransform = `translate3d(0, ${-position * height}px, 0)`
transformStyle.transform = `translate3d(0, ${-position * height}px, 0)`
}
return createElement(
'span',
{
className: `${this.props.prefixCls}-only`,
style: {
transition: removeTransition && 'none',
WebkitTransform: `translate3d(0, ${-position * height}px, 0)`,
transform: `translate3d(0, ${-position * height}px, 0)`,
...transformStyle,
height,
},
key: i,
Expand Down

0 comments on commit 5348566

Please sign in to comment.