mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 13:25:51 +08:00
RN: Remove Native Prop Validation
Summary: As we migrate over to static typing solutions for props, we cannot rely on always having `propTypes` available at runtime. This gets us started on that journey by removing the native prop validation that happens when we require native components. bypass-lint Reviewed By: TheSavior Differential Revision: D7976854 fbshipit-source-id: f3ab579a7f0f8cfb716b0eb7fd4625f8168f3d96
This commit is contained in:
committed by
Facebook Github Bot
parent
6c910549d8
commit
8dc3ba0444
@@ -45,6 +45,28 @@ import type {PointProp} from 'PointPropType';
|
||||
|
||||
import type {ColorValue} from 'StyleSheetTypes';
|
||||
|
||||
let AndroidScrollView;
|
||||
let AndroidHorizontalScrollContentView;
|
||||
let AndroidHorizontalScrollView;
|
||||
let RCTScrollView;
|
||||
let RCTScrollContentView;
|
||||
|
||||
if (Platform.OS === 'android') {
|
||||
AndroidScrollView = requireNativeComponent('RCTScrollView');
|
||||
AndroidHorizontalScrollView = requireNativeComponent(
|
||||
'AndroidHorizontalScrollView',
|
||||
);
|
||||
AndroidHorizontalScrollContentView = requireNativeComponent(
|
||||
'AndroidHorizontalScrollContentView',
|
||||
);
|
||||
} else if (Platform.OS === 'ios') {
|
||||
RCTScrollView = requireNativeComponent('RCTScrollView');
|
||||
RCTScrollContentView = requireNativeComponent('RCTScrollContentView');
|
||||
} else {
|
||||
RCTScrollView = requireNativeComponent('RCTScrollView');
|
||||
RCTScrollContentView = requireNativeComponent('RCTScrollContentView');
|
||||
}
|
||||
|
||||
type TouchableProps = $ReadOnly<{|
|
||||
onTouchStart?: (event: PressEvent) => void,
|
||||
onTouchMove?: (event: PressEvent) => void,
|
||||
@@ -1074,56 +1096,4 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
});
|
||||
|
||||
let nativeOnlyProps,
|
||||
AndroidScrollView,
|
||||
AndroidHorizontalScrollContentView,
|
||||
AndroidHorizontalScrollView,
|
||||
RCTScrollView,
|
||||
RCTScrollContentView;
|
||||
if (Platform.OS === 'android') {
|
||||
nativeOnlyProps = {
|
||||
nativeOnly: {
|
||||
sendMomentumEvents: true,
|
||||
},
|
||||
};
|
||||
AndroidScrollView = requireNativeComponent(
|
||||
'RCTScrollView',
|
||||
(ScrollView: React.ComponentType<any>),
|
||||
nativeOnlyProps,
|
||||
);
|
||||
AndroidHorizontalScrollView = requireNativeComponent(
|
||||
'AndroidHorizontalScrollView',
|
||||
(ScrollView: React.ComponentType<any>),
|
||||
nativeOnlyProps,
|
||||
);
|
||||
AndroidHorizontalScrollContentView = requireNativeComponent(
|
||||
'AndroidHorizontalScrollContentView',
|
||||
);
|
||||
} else if (Platform.OS === 'ios') {
|
||||
nativeOnlyProps = {
|
||||
nativeOnly: {
|
||||
onMomentumScrollBegin: true,
|
||||
onMomentumScrollEnd: true,
|
||||
onScrollBeginDrag: true,
|
||||
onScrollEndDrag: true,
|
||||
},
|
||||
};
|
||||
RCTScrollView = requireNativeComponent(
|
||||
'RCTScrollView',
|
||||
(ScrollView: React.ComponentType<any>),
|
||||
nativeOnlyProps,
|
||||
);
|
||||
RCTScrollContentView = requireNativeComponent('RCTScrollContentView', View);
|
||||
} else {
|
||||
nativeOnlyProps = {
|
||||
nativeOnly: {},
|
||||
};
|
||||
RCTScrollView = requireNativeComponent(
|
||||
'RCTScrollView',
|
||||
null,
|
||||
nativeOnlyProps,
|
||||
);
|
||||
RCTScrollContentView = requireNativeComponent('RCTScrollContentView', View);
|
||||
}
|
||||
|
||||
module.exports = TypedScrollView;
|
||||
|
||||
Reference in New Issue
Block a user