From f2ab0ebdbb78f9fe182d54cae37faadb1a8449f1 Mon Sep 17 00:00:00 2001 From: RCiesielczuk Date: Tue, 22 Jan 2019 05:43:53 -0800 Subject: [PATCH] RCTProgressView (#23077) Summary: Created a standalone JS file for the `RCTProgressView` native component. This PR is part of #22990. Changelog: ---------- [iOS] [Changed] - Created a standalone JS file for the `RCTProgressView` native component Pull Request resolved: https://github.com/facebook/react-native/pull/23077 Differential Revision: D13760036 Pulled By: cpojer fbshipit-source-id: 0f449528b28fde089d9c6b0eb9b752dee3a85af6 --- .../ProgressViewIOS/ProgressViewIOS.ios.js | 15 +++----- .../RCTProgressViewNativeComponent.js | 34 +++++++++++++++++++ 2 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js diff --git a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js index 0c8a7708b..c54e48a82 100644 --- a/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js +++ b/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js @@ -13,9 +13,8 @@ const React = require('React'); const StyleSheet = require('StyleSheet'); -const requireNativeComponent = require('requireNativeComponent'); +const RCTProgressViewNativeComponent = require('RCTProgressViewNativeComponent'); -import type {NativeComponent} from 'ReactNative'; import type {ImageSource} from 'ImageSource'; import type {ColorValue} from 'StyleSheetTypes'; import type {ViewProps} from 'ViewPropTypes'; @@ -54,20 +53,14 @@ type Props = $ReadOnly<{| trackImage?: ?ImageSource, |}>; -type NativeProgressViewIOS = Class>; - -const RCTProgressView = ((requireNativeComponent( - 'RCTProgressView', -): any): NativeProgressViewIOS); - /** * Use `ProgressViewIOS` to render a UIProgressView on iOS. */ const ProgressViewIOS = ( props: Props, - forwardedRef?: ?React.Ref, + forwardedRef?: ?React.Ref, ) => ( - =0.89.0 site=react_native_ios_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 = (ProgressViewIOSWithRef: NativeProgressViewIOS); +module.exports = (ProgressViewIOSWithRef: RCTProgressViewNativeComponent); diff --git a/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js b/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js new file mode 100644 index 000000000..32b2975a5 --- /dev/null +++ b/Libraries/Components/ProgressViewIOS/RCTProgressViewNativeComponent.js @@ -0,0 +1,34 @@ +/** + * 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 {NativeComponent} from 'ReactNative'; +import type {ImageSource} from 'ImageSource'; +import type {ColorValue} from 'StyleSheetTypes'; +import type {ViewProps} from 'ViewPropTypes'; + +type NativeProps = $ReadOnly<{| + ...ViewProps, + progressViewStyle?: ?('default' | 'bar'), + progress?: ?number, + progressTintColor?: ?ColorValue, + trackTintColor?: ?ColorValue, + progressImage?: ?ImageSource, + trackImage?: ?ImageSource, +|}>; + +type NativeProgressViewIOS = Class>; + +module.exports = ((requireNativeComponent( + 'RCTProgressView', +): any): NativeProgressViewIOS);