mirror of
https://github.com/facebook/react-native.git
synced 2024-11-21 22:10:14 +00:00
0aece02cb0
Summary: Changelog: [General][Changed] - ESM requireNativeComponent Reviewed By: yungsters Differential Revision: D42200329 fbshipit-source-id: f1120f06362dc25e48551b3f2421bbda7b68c571
36 lines
929 B
JavaScript
36 lines
929 B
JavaScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
* @flow strict-local
|
|
*/
|
|
|
|
/* eslint-env jest */
|
|
|
|
'use strict';
|
|
|
|
const React = require('react');
|
|
const View = require('../Libraries/Components/View/View');
|
|
|
|
import requireNativeComponent from '../Libraries/ReactNative/requireNativeComponent';
|
|
const RCTScrollView: $FlowFixMe = requireNativeComponent('RCTScrollView');
|
|
|
|
function mockScrollView(BaseComponent: $FlowFixMe) {
|
|
class ScrollViewMock extends BaseComponent {
|
|
render(): React.Element<typeof RCTScrollView> {
|
|
return (
|
|
<RCTScrollView {...this.props}>
|
|
{this.props.refreshControl}
|
|
<View>{this.props.children}</View>
|
|
</RCTScrollView>
|
|
);
|
|
}
|
|
}
|
|
return ScrollViewMock;
|
|
}
|
|
|
|
module.exports = (mockScrollView: $FlowFixMe);
|