@@ -37,6 +37,7 @@ const requireNativeComponent = require('requireNativeComponent');
37
37
* found when Flow v0.54 was deployed. To see the error delete this comment and
38
38
* run Flow. */
39
39
const warning = require ( 'fbjs/lib/warning' ) ;
40
+ const resolveAssetSource = require ( 'resolveAssetSource' ) ;
40
41
41
42
import type { NativeMethodsMixinType } from 'ReactNativeTypes' ;
42
43
@@ -470,6 +471,25 @@ const ScrollView = createReactClass({
470
471
* @platform ios
471
472
*/
472
473
DEPRECATED_sendUpdatedChildFrames : PropTypes . bool ,
474
+ /**
475
+ * Optionally an image can be used for the scroll bar thumb. This will
476
+ * override the color. While the image is loading or the image fails to
477
+ * load the color will be used instead. Use an alpha of 0 in the color
478
+ * to avoid seeing it while the image is loading.
479
+ *
480
+ * - `uri` - a string representing the resource identifier for the image, which
481
+ * should be either a local file path or the name of a static image resource
482
+ * - `number` - Opaque type returned by something like
483
+ * `import IMAGE from './image.jpg'`.
484
+ * @platform vr
485
+ */
486
+ scrollBarThumbImage : PropTypes . oneOfType ( [
487
+ PropTypes . shape ( {
488
+ uri : PropTypes . string ,
489
+ } ) ,
490
+ // Opaque type returned by import IMAGE from './image.jpg'
491
+ PropTypes . number ,
492
+ ] ) ,
473
493
} ,
474
494
475
495
mixins : [ ScrollResponder . Mixin ] ,
@@ -674,21 +694,21 @@ const ScrollView = createReactClass({
674
694
render : function ( ) {
675
695
let ScrollViewClass ;
676
696
let ScrollContentContainerViewClass ;
677
- if ( Platform . OS === 'ios' ) {
678
- ScrollViewClass = RCTScrollView ;
679
- ScrollContentContainerViewClass = RCTScrollContentView ;
680
- warning (
681
- ! this . props . snapToInterval || ! this . props . pagingEnabled ,
682
- 'snapToInterval is currently ignored when pagingEnabled is true.'
683
- ) ;
684
- } else if ( Platform . OS === 'android' ) {
697
+ if ( Platform . OS === 'android' ) {
685
698
if ( this . props . horizontal ) {
686
699
ScrollViewClass = AndroidHorizontalScrollView ;
687
700
ScrollContentContainerViewClass = AndroidHorizontalScrollContentView ;
688
701
} else {
689
702
ScrollViewClass = AndroidScrollView ;
690
703
ScrollContentContainerViewClass = View ;
691
704
}
705
+ } else {
706
+ ScrollViewClass = RCTScrollView ;
707
+ ScrollContentContainerViewClass = RCTScrollContentView ;
708
+ warning (
709
+ ! this . props . snapToInterval || ! this . props . pagingEnabled ,
710
+ 'snapToInterval is currently ignored when pagingEnabled is true.'
711
+ ) ;
692
712
}
693
713
694
714
invariant (
@@ -805,6 +825,7 @@ const ScrollView = createReactClass({
805
825
onTouchMove : this . scrollResponderHandleTouchMove ,
806
826
onTouchStart : this . scrollResponderHandleTouchStart ,
807
827
onTouchCancel : this . scrollResponderHandleTouchCancel ,
828
+ scrollBarThumbImage : resolveAssetSource ( this . props . scrollBarThumbImage ) ,
808
829
scrollEventThrottle : hasStickyHeaders ? 1 : this . props . scrollEventThrottle ,
809
830
sendMomentumEvents : ( this . props . onMomentumScrollBegin || this . props . onMomentumScrollEnd ) ?
810
831
true : false ,
@@ -910,6 +931,17 @@ if (Platform.OS === 'android') {
910
931
nativeOnlyProps ,
911
932
) ;
912
933
RCTScrollContentView = requireNativeComponent ( 'RCTScrollContentView' , View ) ;
934
+ } else {
935
+ nativeOnlyProps = {
936
+ nativeOnly : {
937
+ }
938
+ } ;
939
+ RCTScrollView = requireNativeComponent (
940
+ 'RCTScrollView' ,
941
+ null ,
942
+ nativeOnlyProps ,
943
+ ) ;
944
+ RCTScrollContentView = requireNativeComponent ( 'RCTScrollContentView' , View ) ;
913
945
}
914
946
915
947
module . exports = ScrollView ;
0 commit comments