mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48807 ## Motivation Modernising the react-native codebase to allow for ingestion by modern Flow tooling. ## This diff - Updates a handful of components in `Libraries/Components` to use `export` syntax - `export default` for qualified objects, many `export` statements for collections (determined by how it's imported) - Appends `.default` to requires of the changed files. - Updates test files. - Updates the public API snapshot (intented breaking change) Changelog: [General][Breaking] - Files inside `Libraries/Components` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax. Reviewed By: huntie Differential Revision: D68436127 fbshipit-source-id: e3496fe69d66932dd4ed82f41d810f3ef1f850f5
36 lines
934 B
JavaScript
36 lines
934 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 View = require('../Libraries/Components/View/View').default;
|
|
const requireNativeComponent =
|
|
require('../Libraries/ReactNative/requireNativeComponent').default;
|
|
const React = require('react');
|
|
const RCTScrollView: $FlowFixMe = requireNativeComponent('RCTScrollView');
|
|
|
|
function mockScrollView(BaseComponent: $FlowFixMe) {
|
|
class ScrollViewMock extends BaseComponent {
|
|
render(): React.MixedElement {
|
|
return (
|
|
<RCTScrollView {...this.props}>
|
|
{this.props.refreshControl}
|
|
<View>{this.props.children}</View>
|
|
</RCTScrollView>
|
|
);
|
|
}
|
|
}
|
|
return ScrollViewMock;
|
|
}
|
|
|
|
module.exports = (mockScrollView: $FlowFixMe);
|