ProgressViewIOS.ios.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow strict-local
  9. */
  10. 'use strict';
  11. const React = require('react');
  12. const StyleSheet = require('../../StyleSheet/StyleSheet');
  13. import RCTProgressViewNativeComponent from './RCTProgressViewNativeComponent';
  14. import type {ImageSource} from '../../Image/ImageSource';
  15. import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
  16. import type {ViewProps} from '../View/ViewPropTypes';
  17. type Props = $ReadOnly<{|
  18. ...ViewProps,
  19. /**
  20. * The progress bar style.
  21. */
  22. progressViewStyle?: ?('default' | 'bar'),
  23. /**
  24. * The progress value (between 0 and 1).
  25. */
  26. progress?: ?number,
  27. /**
  28. * The tint color of the progress bar itself.
  29. */
  30. progressTintColor?: ?ColorValue,
  31. /**
  32. * The tint color of the progress bar track.
  33. */
  34. trackTintColor?: ?ColorValue,
  35. /**
  36. * A stretchable image to display as the progress bar.
  37. */
  38. progressImage?: ?ImageSource,
  39. /**
  40. * A stretchable image to display behind the progress bar.
  41. */
  42. trackImage?: ?ImageSource,
  43. |}>;
  44. /**
  45. * Use `ProgressViewIOS` to render a UIProgressView on iOS.
  46. */
  47. const ProgressViewIOS = (
  48. props: Props,
  49. forwardedRef?: ?React.Ref<typeof RCTProgressViewNativeComponent>,
  50. ) => (
  51. <RCTProgressViewNativeComponent
  52. {...props}
  53. style={[styles.progressView, props.style]}
  54. ref={forwardedRef}
  55. />
  56. );
  57. const styles = StyleSheet.create({
  58. progressView: {
  59. height: 2,
  60. },
  61. });
  62. const ProgressViewIOSWithRef = React.forwardRef(ProgressViewIOS);
  63. module.exports = (ProgressViewIOSWithRef: typeof RCTProgressViewNativeComponent);