ScrollViewCommands.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. import codegenNativeCommands from '../../Utilities/codegenNativeCommands';
  11. import * as React from 'react';
  12. import type {Double} from 'react-native/Libraries/Types/CodegenTypes';
  13. import type {HostComponent} from '../../Renderer/shims/ReactNativeTypes';
  14. type ScrollViewNativeComponentType = HostComponent<mixed>;
  15. interface NativeCommands {
  16. +flashScrollIndicators: (
  17. viewRef: React.ElementRef<ScrollViewNativeComponentType>,
  18. ) => void;
  19. +scrollTo: (
  20. viewRef: React.ElementRef<ScrollViewNativeComponentType>,
  21. x: Double,
  22. y: Double,
  23. animated: boolean,
  24. ) => void;
  25. +scrollToEnd: (
  26. viewRef: React.ElementRef<ScrollViewNativeComponentType>,
  27. animated: boolean,
  28. ) => void;
  29. +zoomToRect: (
  30. viewRef: React.ElementRef<ScrollViewNativeComponentType>,
  31. rect: {|
  32. x: Double,
  33. y: Double,
  34. width: Double,
  35. height: Double,
  36. animated?: boolean,
  37. |},
  38. animated?: boolean,
  39. ) => void;
  40. }
  41. export default (codegenNativeCommands<NativeCommands>({
  42. supportedCommands: [
  43. 'flashScrollIndicators',
  44. 'scrollTo',
  45. 'scrollToEnd',
  46. 'zoomToRect',
  47. ],
  48. }): NativeCommands);