Files
react-native/Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js
glevi@fb.com 24f8d4d3db Deploy v0.89
Reviewed By: jbrown215

Differential Revision: D13457087

fbshipit-source-id: 9f01371ae3515990c5595f1eb2361174050066b8
2018-12-14 13:57:50 -08:00

89 lines
2.0 KiB
JavaScript

/**
* 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.
*
* @format
* @flow
*/
'use strict';
const React = require('React');
const StyleSheet = require('StyleSheet');
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 Props = $ReadOnly<{|
...ViewProps,
/**
* The progress bar style.
*/
progressViewStyle?: ?('default' | 'bar'),
/**
* The progress value (between 0 and 1).
*/
progress?: ?number,
/**
* The tint color of the progress bar itself.
*/
progressTintColor?: ?ColorValue,
/**
* The tint color of the progress bar track.
*/
trackTintColor?: ?ColorValue,
/**
* A stretchable image to display as the progress bar.
*/
progressImage?: ?ImageSource,
/**
* A stretchable image to display behind the progress bar.
*/
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>,
) => (
<RCTProgressView
{...props}
style={[styles.progressView, props.style]}
ref={forwardedRef}
/>
);
const styles = StyleSheet.create({
progressView: {
height: 2,
},
});
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);