Skip to content

Commit ead160a

Browse files
Merge pull request #74 from ksairi/master
added new property in case of images' width are smaller than window's screen
2 parents f0baad3 + 0d45e9e commit ead160a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ImageSlider.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type PropsType = {
3434
onPress?: Object => void,
3535
customButtons?: (number, (number, animated?: boolean) => void) => Node,
3636
customSlide?: Slide => Node,
37+
imagesWidth: number
3738
};
3839

3940
type StateType = {
@@ -75,7 +76,9 @@ class ImageSlider extends Component<PropsType, StateType> {
7576
return;
7677
}
7778
const isUpdating = index !== this._getPosition();
78-
const x = Dimensions.get('window').width * index;
79+
const x = (this.props.imagesWidth ?
80+
this.props.imagesWidth : Dimensions.get("window").width)
81+
* index;
7982

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

0 commit comments

Comments
 (0)