From 148dc31d58e29624685c0ae952283e47ac7bbfcd Mon Sep 17 00:00:00 2001 From: Rafael Lincoln Date: Tue, 22 Jan 2019 02:45:48 -0800 Subject: [PATCH] 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 --- .../ProgressBarAndroid.android.js | 13 +++----- .../ProgressBarAndroidNativeComponent.js | 33 +++++++++++++++++++ 2 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js index efddfdd3b3ab32..616dfc7ed7e07c 100644 --- a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js @@ -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, ) => { - return ; + return ; }; 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, ->); +module.exports = (ProgressBarAndroidToExport: ProgressBarAndroidNativeComponent); diff --git a/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js new file mode 100644 index 00000000000000..8e897540f7543d --- /dev/null +++ b/Libraries/Components/ProgressBarAndroid/ProgressBarAndroidNativeComponent.js @@ -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>; + +module.exports = ((requireNativeComponent( + 'AndroidProgressBar', +): any): ProgressBarAndroidType);