Skip to content

Commit

Permalink
Use translate3d to get hw-acccerlation on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Photonios committed Oct 16, 2017
1 parent 7ac60c6 commit 794b677
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions build/image-gallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,7 +743,7 @@ var ImageGallery = function (_React$Component) {
translateX = this._getTranslateXForTwoSlide(index);
}

var translate = 'translate(' + translateX + '%, 0)';
var translate = 'translate3d(' + translateX + '%, 0, 0)';

return {
WebkitTransform: translate,
Expand All @@ -759,9 +759,9 @@ var ImageGallery = function (_React$Component) {
var translate = void 0;

if (this._isThumbnailHorizontal()) {
translate = 'translate(0, ' + this.state.thumbsTranslate + 'px)';
translate = 'translate3d(0, ' + this.state.thumbsTranslate + 'px, 0)';
} else {
translate = 'translate(' + this.state.thumbsTranslate + 'px, 0)';
translate = 'translate3d(' + this.state.thumbsTranslate + 'px, 0, 0)';
}
return {
WebkitTransform: translate,
Expand Down
6 changes: 3 additions & 3 deletions src/ImageGallery.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ export default class ImageGallery extends React.Component {
translateX = this._getTranslateXForTwoSlide(index);
}

const translate = `translate(${translateX}%, 0)`;
const translate = `translate3d(${translateX}%, 0, 0)`;

return {
WebkitTransform: translate,
Expand All @@ -778,9 +778,9 @@ export default class ImageGallery extends React.Component {
let translate;

if (this._isThumbnailHorizontal()) {
translate = `translate(0, ${this.state.thumbsTranslate}px)`;
translate = `translate3d(0, ${this.state.thumbsTranslate}px, 0)`;
} else {
translate = `translate(${this.state.thumbsTranslate}px, 0)`;
translate = `translate3d(${this.state.thumbsTranslate}px, 0, 0)`;
}
return {
WebkitTransform: translate,
Expand Down

0 comments on commit 794b677

Please sign in to comment.