mockScrollView.js 932 B

1234567891011121314151617181920212223242526272829303132333435
  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. /* eslint-env jest */
  11. 'use strict';
  12. const React = require('react');
  13. const View = require('../Libraries/Components/View/View');
  14. const requireNativeComponent = require('../Libraries/ReactNative/requireNativeComponent');
  15. const RCTScrollView: $FlowFixMe = requireNativeComponent('RCTScrollView');
  16. function mockScrollView(BaseComponent: $FlowFixMe) {
  17. class ScrollViewMock extends BaseComponent {
  18. render(): React.Element<typeof RCTScrollView> {
  19. return (
  20. <RCTScrollView {...this.props}>
  21. {this.props.refreshControl}
  22. <View>{this.props.children}</View>
  23. </RCTScrollView>
  24. );
  25. }
  26. }
  27. return ScrollViewMock;
  28. }
  29. module.exports = (mockScrollView: $FlowFixMe);