Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Standalone for NativeComponents] RCTProgressView #23077

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -54,20 +53,14 @@ type Props = $ReadOnly<{|
trackImage?: ?ImageSource,
|}>;

type NativeProgressViewIOS = Class<NativeComponent<Props>>;

const RCTProgressView = ((requireNativeComponent(
'RCTProgressView',
): any): NativeProgressViewIOS);

/**
* Use `ProgressViewIOS` to render a UIProgressView on iOS.
*/
const ProgressViewIOS = (
props: Props,
forwardedRef?: ?React.Ref<typeof RCTProgressView>,
forwardedRef?: ?React.Ref<typeof RCTProgressViewNativeComponent>,
) => (
<RCTProgressView
<RCTProgressViewNativeComponent
{...props}
style={[styles.progressView, props.style]}
ref={forwardedRef}
Expand All @@ -85,4 +78,4 @@ const ProgressViewIOSWithRef = React.forwardRef(ProgressViewIOS);
/* $FlowFixMe(>=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);
Original file line number Diff line number Diff line change
@@ -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<NativeComponent<NativeProps>>;

module.exports = ((requireNativeComponent(
'RCTProgressView',
): any): NativeProgressViewIOS);