Skip to content

Commit

Permalink
added new property in case of images' width are smaller thant window'…
Browse files Browse the repository at this point in the history
…s width
  • Loading branch information
ksairi committed Sep 19, 2018
1 parent 220a186 commit 2e8285b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6,107 deletions.
5 changes: 4 additions & 1 deletion ImageSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type PropsType = {
onPress?: Object => void,
customButtons?: (number, (number, animated?: boolean) => void) => Node,
customSlide?: Slide => Node,
imagesWidth: number
};

type StateType = {
Expand Down Expand Up @@ -75,7 +76,9 @@ class ImageSlider extends Component<PropsType, StateType> {
return;
}
const isUpdating = index !== this._getPosition();
const x = Dimensions.get('window').width * index;
const x = (this.props.imagesWidth ?
this.props.imagesWidth : Dimensions.get("window").width)
* index;

this._ref && this._ref.scrollTo({ y: 0, x, animated });

Expand Down
Loading

0 comments on commit 2e8285b

Please sign in to comment.