mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-26 05:15:49 +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
@@ -11,7 +11,6 @@
|
||||
'use strict';
|
||||
|
||||
const Platform = require('Platform');
|
||||
const ProgressBarAndroid = require('ProgressBarAndroid');
|
||||
const React = require('React');
|
||||
const StyleSheet = require('StyleSheet');
|
||||
const View = require('View');
|
||||
@@ -21,7 +20,10 @@ const requireNativeComponent = require('requireNativeComponent');
|
||||
import type {NativeComponent} from 'ReactNative';
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
|
||||
let RCTActivityIndicator;
|
||||
const RCTActivityIndicator =
|
||||
Platform.OS === 'android'
|
||||
? require('ProgressBarAndroid')
|
||||
: requireNativeComponent('RCTActivityIndicatorView');
|
||||
|
||||
const GRAY = '#999999';
|
||||
|
||||
@@ -98,11 +100,7 @@ const ActivityIndicator = (
|
||||
|
||||
return (
|
||||
<View onLayout={onLayout} style={[styles.container, style]}>
|
||||
{Platform.OS === 'ios' ? (
|
||||
<RCTActivityIndicator {...nativeProps} />
|
||||
) : (
|
||||
<ProgressBarAndroid {...nativeProps} />
|
||||
)}
|
||||
<RCTActivityIndicator {...nativeProps} />
|
||||
</View>
|
||||
);
|
||||
};
|
||||
@@ -120,14 +118,6 @@ ActivityIndicatorWithRef.defaultProps = {
|
||||
};
|
||||
ActivityIndicatorWithRef.displayName = 'ActivityIndicator';
|
||||
|
||||
if (Platform.OS === 'ios') {
|
||||
RCTActivityIndicator = requireNativeComponent(
|
||||
'RCTActivityIndicatorView',
|
||||
null,
|
||||
{nativeOnly: {activityIndicatorViewStyle: true}},
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
alignItems: 'center',
|
||||
|
||||
Reference in New Issue
Block a user