SliderNativeComponent.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. import type {
  12. BubblingEventHandler,
  13. DirectEventHandler,
  14. Double,
  15. WithDefault,
  16. } from '../../Types/CodegenTypes';
  17. import codegenNativeComponent from '../../Utilities/codegenNativeComponent';
  18. import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
  19. import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
  20. import type {ImageSource} from '../../Image/ImageSource';
  21. import type {ViewProps} from '../View/ViewPropTypes';
  22. type Event = $ReadOnly<{|
  23. value: Double,
  24. fromUser?: boolean,
  25. |}>;
  26. type NativeProps = $ReadOnly<{|
  27. ...ViewProps,
  28. // Props
  29. disabled?: WithDefault<boolean, false>,
  30. enabled?: WithDefault<boolean, true>,
  31. maximumTrackImage?: ?ImageSource,
  32. maximumTrackTintColor?: ?ColorValue,
  33. maximumValue?: WithDefault<Double, 1>,
  34. minimumTrackImage?: ?ImageSource,
  35. minimumTrackTintColor?: ?ColorValue,
  36. minimumValue?: WithDefault<Double, 0>,
  37. step?: WithDefault<Double, 0>,
  38. testID?: WithDefault<string, ''>,
  39. thumbImage?: ?ImageSource,
  40. thumbTintColor?: ?ColorValue,
  41. trackImage?: ?ImageSource,
  42. value?: WithDefault<Double, 0>,
  43. // Events
  44. onChange?: ?BubblingEventHandler<Event>,
  45. onValueChange?: ?BubblingEventHandler<Event, 'paperValueChange'>,
  46. onSlidingComplete?: ?DirectEventHandler<Event, 'paperSlidingComplete'>,
  47. |}>;
  48. export default (codegenNativeComponent<NativeProps>('Slider', {
  49. interfaceOnly: true,
  50. paperComponentName: 'RCTSlider',
  51. }): HostComponent<NativeProps>);