Skip to content

Commit

Permalink
Fix for ActivityIndicator on Android
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rickhanlonii authored and facebook-github-bot committed May 27, 2019
1 parent a0f2bfa commit 9560776
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Libraries/Components/ActivityIndicator/ActivityIndicator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -92,19 +93,23 @@ const ActivityIndicator = (props: Props, forwardedRef?: any) => {
size: sizeProp,
};

const androidProps = {
styleAttr: 'Normal',
indeterminate: true,
};

return (
<View
onLayout={onLayout}
style={StyleSheet.compose(
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>
);
Expand Down

0 comments on commit 9560776

Please sign in to comment.