mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Move RefreshControlMock into Jest preset files (#51530)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51530 Alternative to https://github.com/facebook/react-native/pull/50784. `__mocks__` (and other underscored dirs) are correctly excluded from our npm package via `package.json#files`. But in this instance, this is a source file for the `jest/` directory (Jest preset within `react-native`), and should be included — fix by relocating. Changelog: [General][Fixed] - Fix missing RefreshControlMock source in Jest preset Reviewed By: rshest Differential Revision: D75215731 fbshipit-source-id: 1240344c4236288f31b16513f4df16766ad1e571
This commit is contained in:
committed by
Fabrizio Cucci
parent
6f3948fc48
commit
aeab69a744
+9
-9
@@ -4,29 +4,29 @@
|
||||
* 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
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {HostComponent} from '../../../../src/private/types/HostComponent';
|
||||
import type {HostComponent} from '../src/private/types/HostComponent';
|
||||
|
||||
import requireNativeComponent from '../../../ReactNative/requireNativeComponent';
|
||||
import requireNativeComponent from '../Libraries/ReactNative/requireNativeComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
const RCTRefreshControl: HostComponent<{}> = requireNativeComponent<{}>(
|
||||
'RCTRefreshControl',
|
||||
);
|
||||
|
||||
class RefreshControlMock extends React.Component<{...}> {
|
||||
export default class RefreshControlMock extends React.Component<{...}> {
|
||||
static latestRef: ?RefreshControlMock;
|
||||
|
||||
render(): React.Node {
|
||||
return <RCTRefreshControl />;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
RefreshControlMock.latestRef = this;
|
||||
}
|
||||
render(): React.MixedElement {
|
||||
return <RCTRefreshControl />;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = RefreshControlMock;
|
||||
Vendored
+1
-3
@@ -201,9 +201,7 @@ jest
|
||||
}))
|
||||
.mock('../Libraries/Components/RefreshControl/RefreshControl', () => ({
|
||||
__esModule: true,
|
||||
default: jest.requireActual(
|
||||
'../Libraries/Components/RefreshControl/__mocks__/RefreshControlMock',
|
||||
),
|
||||
default: jest.requireActual('./RefreshControlMock').default,
|
||||
}))
|
||||
.mock('../Libraries/Components/ScrollView/ScrollView', () => {
|
||||
const baseComponent = mockComponent(
|
||||
|
||||
Reference in New Issue
Block a user