@@ -114,6 +114,10 @@ export default class extends Component {
114114 PropTypes . object ,
115115 PropTypes . number ,
116116 ] ) ,
117+ scrollViewStyle : PropTypes . oneOfType ( [
118+ PropTypes . object ,
119+ PropTypes . number ,
120+ ] ) ,
117121 pagingEnabled : PropTypes . bool ,
118122 showsHorizontalScrollIndicator : PropTypes . bool ,
119123 showsVerticalScrollIndicator : PropTypes . bool ,
@@ -231,12 +235,28 @@ export default class extends Component {
231235 const { width, height } = Dimensions . get ( 'window' )
232236
233237 initState . dir = props . horizontal === false ? 'y' : 'x'
234- initState . width = props . width || width
235- initState . height = props . height || height
238+
239+ if ( props . width ) {
240+ initState . width = props . width
241+ } else if ( this . state && this . state . width ) {
242+ initState . width = this . state . width
243+ } else {
244+ initState . width = width ;
245+ }
246+
247+ if ( props . height ) {
248+ initState . height = props . height
249+ } else if ( this . state && this . state . height ) {
250+ initState . height = this . state . height
251+ } else {
252+ initState . height = height ;
253+ }
254+
236255 initState . offset [ initState . dir ] = initState . dir === 'y'
237256 ? height * props . index
238257 : width * props . index
239258
259+
240260 this . internals = {
241261 ...this . internals ,
242262 isScrolling : false
@@ -610,7 +630,8 @@ export default class extends Component {
610630 contentOffset = { this . state . offset }
611631 onScrollBeginDrag = { this . onScrollBegin }
612632 onMomentumScrollEnd = { this . onScrollEnd }
613- onScrollEndDrag = { this . onScrollEndDrag } >
633+ onScrollEndDrag = { this . onScrollEndDrag }
634+ style = { this . props . scrollViewStyle } >
614635 { pages }
615636 </ ScrollView >
616637 )
0 commit comments