Fix for ActivityIndicator on Android

Summary: Fixes an issue that was including the view config native component verification function even when the native component wasn't included (e.g. on android)

Reviewed By: mdvacca

Differential Revision: D15513535

fbshipit-source-id: 9b615689c0d64757eeb3d66862e5b1902ea79b20
This commit is contained in:
Rick Hanlon
2019-05-27 11:50:07 -07:00
committed by Facebook Github Bot
parent a0f2bfa120
commit 956077675e
@@ -15,12 +15,13 @@ const React = require('react');
const StyleSheet = require('../../StyleSheet/StyleSheet');
const View = require('../View/View');
const ActivityIndicatorViewNativeComponent = require('./ActivityIndicatorViewNativeComponent');
import type {NativeComponent} from '../../Renderer/shims/ReactNative';
import type {ViewProps} from '../View/ViewPropTypes';
const ProgressBarAndroid = require('../ProgressBarAndroid/ProgressBarAndroid');
const PlatformActivityIndicator =
Platform.OS === 'android'
? require('../ProgressBarAndroid/ProgressBarAndroid')
: require('./ActivityIndicatorViewNativeComponent');
const GRAY = '#999999';
@@ -92,6 +93,11 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => {
size: sizeProp,
};
const androidProps = {
styleAttr: 'Normal',
indeterminate: true,
};
return (
<View
onLayout={onLayout}
@@ -99,12 +105,11 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => {
styles.container,
style,
)}>
{/* $FlowFixMe(>=0.78.0 site=react_native_android_fb) This issue was
* found when making Flow check .android.js files. */}
{Platform.OS === 'android' ? (
<ProgressBarAndroid {...nativeProps} styleAttr="Normal" indeterminate />
// $FlowFixMe Flow doesn't know when this is the android component
<PlatformActivityIndicator {...nativeProps} {...androidProps} />
) : (
<ActivityIndicatorViewNativeComponent {...nativeProps} />
<PlatformActivityIndicator {...nativeProps} />
)}
</View>
);