@@ -45,6 +45,28 @@ import type {PointProp} from 'PointPropType';
45
45
46
46
import type { ColorValue } from 'StyleSheetTypes' ;
47
47
48
+ let AndroidScrollView ;
49
+ let AndroidHorizontalScrollContentView ;
50
+ let AndroidHorizontalScrollView ;
51
+ let RCTScrollView ;
52
+ let RCTScrollContentView ;
53
+
54
+ if ( Platform . OS === 'android' ) {
55
+ AndroidScrollView = requireNativeComponent ( 'RCTScrollView' ) ;
56
+ AndroidHorizontalScrollView = requireNativeComponent (
57
+ 'AndroidHorizontalScrollView' ,
58
+ ) ;
59
+ AndroidHorizontalScrollContentView = requireNativeComponent (
60
+ 'AndroidHorizontalScrollContentView' ,
61
+ ) ;
62
+ } else if ( Platform . OS === 'ios' ) {
63
+ RCTScrollView = requireNativeComponent ( 'RCTScrollView' ) ;
64
+ RCTScrollContentView = requireNativeComponent ( 'RCTScrollContentView' ) ;
65
+ } else {
66
+ RCTScrollView = requireNativeComponent ( 'RCTScrollView' ) ;
67
+ RCTScrollContentView = requireNativeComponent ( 'RCTScrollContentView' ) ;
68
+ }
69
+
48
70
type TouchableProps = $ReadOnly < { |
49
71
onTouchStart ?: ( event : PressEvent ) => void ,
50
72
onTouchMove ?: ( event : PressEvent ) => void ,
@@ -1074,56 +1096,4 @@ const styles = StyleSheet.create({
1074
1096
} ,
1075
1097
} ) ;
1076
1098
1077
- let nativeOnlyProps ,
1078
- AndroidScrollView ,
1079
- AndroidHorizontalScrollContentView ,
1080
- AndroidHorizontalScrollView ,
1081
- RCTScrollView ,
1082
- RCTScrollContentView ;
1083
- if ( Platform . OS === 'android' ) {
1084
- nativeOnlyProps = {
1085
- nativeOnly : {
1086
- sendMomentumEvents : true ,
1087
- } ,
1088
- } ;
1089
- AndroidScrollView = requireNativeComponent (
1090
- 'RCTScrollView' ,
1091
- ( ScrollView : React . ComponentType < any > ) ,
1092
- nativeOnlyProps ,
1093
- ) ;
1094
- AndroidHorizontalScrollView = requireNativeComponent (
1095
- 'AndroidHorizontalScrollView' ,
1096
- ( ScrollView : React . ComponentType < any > ) ,
1097
- nativeOnlyProps ,
1098
- ) ;
1099
- AndroidHorizontalScrollContentView = requireNativeComponent (
1100
- 'AndroidHorizontalScrollContentView' ,
1101
- ) ;
1102
- } else if ( Platform . OS === 'ios' ) {
1103
- nativeOnlyProps = {
1104
- nativeOnly : {
1105
- onMomentumScrollBegin : true ,
1106
- onMomentumScrollEnd : true ,
1107
- onScrollBeginDrag : true ,
1108
- onScrollEndDrag : true ,
1109
- } ,
1110
- } ;
1111
- RCTScrollView = requireNativeComponent (
1112
- 'RCTScrollView' ,
1113
- ( ScrollView : React . ComponentType < any > ) ,
1114
- nativeOnlyProps ,
1115
- ) ;
1116
- RCTScrollContentView = requireNativeComponent ( 'RCTScrollContentView' , View ) ;
1117
- } else {
1118
- nativeOnlyProps = {
1119
- nativeOnly : { } ,
1120
- } ;
1121
- RCTScrollView = requireNativeComponent (
1122
- 'RCTScrollView' ,
1123
- null ,
1124
- nativeOnlyProps ,
1125
- ) ;
1126
- RCTScrollContentView = requireNativeComponent ( 'RCTScrollContentView' , View ) ;
1127
- }
1128
-
1129
1099
module . exports = TypedScrollView ;
0 commit comments