ProgressBarAndroid (#23068)

Summary:
his PR is related to #22990

Changelog:
----------

[Android][Changed] - move the call to requireNativeComponent from ProgressBarAndroid.android.js to ProgressBarAndroidNativeComponent.js
Pull Request resolved: https://github.com/facebook/react-native/pull/23068

Differential Revision: D13760445

Pulled By: cpojer

fbshipit-source-id: b74ff42c6f207803de70be549a13487d59125a66
This commit is contained in:
Rafael Lincoln 2019-01-22 02:45:48 -08:00 committed by Facebook Github Bot
parent 6c18069a28
commit bf27799ba8
2 changed files with 37 additions and 9 deletions

View File

@ -12,13 +12,10 @@
const React = require('React');
const requireNativeComponent = require('requireNativeComponent');
const ProgressBarAndroidNativeComponent = require('ProgressBarAndroidNativeComponent');
import type {NativeComponent} from 'ReactNative';
import type {ViewProps} from 'ViewPropTypes';
const AndroidProgressBar = requireNativeComponent('AndroidProgressBar');
export type ProgressBarAndroidProps = $ReadOnly<{|
...ViewProps,
@ -84,9 +81,9 @@ export type ProgressBarAndroidProps = $ReadOnly<{|
*/
const ProgressBarAndroid = (
props: ProgressBarAndroidProps,
forwardedRef: ?React.Ref<'AndroidProgressBar'>,
forwardedRef: ?React.Ref<typeof ProgressBarAndroidNativeComponent>,
) => {
return <AndroidProgressBar {...props} ref={forwardedRef} />;
return <ProgressBarAndroidNativeComponent {...props} ref={forwardedRef} />;
};
const ProgressBarAndroidToExport = React.forwardRef(ProgressBarAndroid);
@ -103,6 +100,4 @@ ProgressBarAndroidToExport.defaultProps = {
/* $FlowFixMe(>=0.89.0 site=react_native_android_fb) This comment suppresses an
* error found when Flow v0.89 was deployed. To see the error, delete this
* comment and run Flow. */
module.exports = (ProgressBarAndroidToExport: Class<
NativeComponent<ProgressBarAndroidProps>,
>);
module.exports = (ProgressBarAndroidToExport: ProgressBarAndroidNativeComponent);

View File

@ -0,0 +1,33 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
const requireNativeComponent = require('requireNativeComponent');
import type {ViewProps} from 'ViewPropTypes';
import type {NativeComponent} from 'ReactNative';
type NativeProps = $ReadOnly<{|
...ViewProps,
styleAttr?: string,
typeAttr?: string,
indeterminate: boolean,
progress?: number,
animating?: ?boolean,
color?: ?string,
testID?: ?string,
|}>;
type ProgressBarAndroidType = Class<NativeComponent<NativeProps>>;
module.exports = ((requireNativeComponent(
'AndroidProgressBar',
): any): ProgressBarAndroidType);