RCTSegmentedControlNativeComponent.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. * @flow strict-local
  8. * @format
  9. */
  10. 'use strict';
  11. import codegenNativeComponent from '../../Utilities/codegenNativeComponent';
  12. import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
  13. import type {ViewProps} from '../View/ViewPropTypes';
  14. import type {
  15. BubblingEventHandler,
  16. WithDefault,
  17. Int32,
  18. } from '../../Types/CodegenTypes';
  19. import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
  20. export type OnChangeEvent = $ReadOnly<{|
  21. value: Int32,
  22. selectedSegmentIndex: Int32,
  23. |}>;
  24. type NativeProps = $ReadOnly<{|
  25. ...ViewProps,
  26. // Props
  27. values?: $ReadOnlyArray<string>,
  28. selectedIndex?: WithDefault<Int32, 0>,
  29. enabled?: WithDefault<boolean, true>,
  30. tintColor?: ?ColorValue,
  31. textColor?: ?ColorValue,
  32. backgroundColor?: ?ColorValue,
  33. momentary?: WithDefault<boolean, false>,
  34. // Events
  35. onChange?: ?BubblingEventHandler<OnChangeEvent>,
  36. |}>;
  37. export default (codegenNativeComponent<NativeProps>(
  38. 'RCTSegmentedControl',
  39. ): HostComponent<NativeProps>);