Files
react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js
T
Nick Gerleman 161b910494 Do not explicitly include ".js" in Library imports (#28311)
Summary:
A few recent imports have explicitly added ".js" to the end of their path. This prevents Metro from resolving platform-specific JS files, e.g. "Foo.android.js" or "Foo.windows.js" instead of "Foo.js".

React Native Windows provides its own implementation of files in a few cases where stock React Native will share them between Android and iOS. We hope to reduce/eliminate these long term, but requiring explicit ".js" files currently breaks us in a couple of places where we have custom implementations.

This change is a quick regex replace of ES6 and CommonJS imports in 'Libraries/" to eliminate ".js".

## Changelog

[General] [Fixed] - Do not explicitly include ".js" in Library imports
Pull Request resolved: https://github.com/facebook/react-native/pull/28311

Test Plan: I haven't done any manual validation of this, but `flow-check` should catch any issues with this during CI.

Reviewed By: cpojer

Differential Revision: D20486466

Pulled By: TheSavior

fbshipit-source-id: 31e1ccc307967417d7d09c34c859f0b2b69eac84
2020-03-17 02:11:53 -07:00

62 lines
2.3 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its 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
*/
import typeof BatchedBridge from '../BatchedBridge/BatchedBridge';
import typeof ExceptionsManager from '../Core/ExceptionsManager';
import typeof Platform from '../Utilities/Platform';
import typeof RCTEventEmitter from '../EventEmitter/RCTEventEmitter';
import typeof ReactNativeViewConfigRegistry from '../Renderer/shims/ReactNativeViewConfigRegistry';
import typeof TextInputState from '../Components/TextInput/TextInputState';
import typeof UIManager from '../ReactNative/UIManager';
import typeof deepDiffer from '../Utilities/differ/deepDiffer';
import typeof deepFreezeAndThrowOnMutationInDev from '../Utilities/deepFreezeAndThrowOnMutationInDev';
import typeof flattenStyle from '../StyleSheet/flattenStyle';
import typeof ReactFiberErrorDialog from '../Core/ReactFiberErrorDialog';
// flowlint unsafe-getters-setters:off
module.exports = {
get BatchedBridge(): BatchedBridge {
return require('../BatchedBridge/BatchedBridge');
},
get ExceptionsManager(): ExceptionsManager {
return require('../Core/ExceptionsManager');
},
get Platform(): Platform {
return require('../Utilities/Platform');
},
get RCTEventEmitter(): RCTEventEmitter {
return require('../EventEmitter/RCTEventEmitter');
},
get ReactNativeViewConfigRegistry(): ReactNativeViewConfigRegistry {
return require('../Renderer/shims/ReactNativeViewConfigRegistry');
},
get TextInputState(): TextInputState {
return require('../Components/TextInput/TextInputState');
},
get UIManager(): UIManager {
return require('../ReactNative/UIManager');
},
get deepDiffer(): deepDiffer {
return require('../Utilities/differ/deepDiffer');
},
get deepFreezeAndThrowOnMutationInDev(): deepFreezeAndThrowOnMutationInDev<
// $FlowFixMe - can't properly parameterize the getter's type
*,
> {
return require('../Utilities/deepFreezeAndThrowOnMutationInDev');
},
get flattenStyle(): flattenStyle {
return require('../StyleSheet/flattenStyle');
},
get ReactFiberErrorDialog(): ReactFiberErrorDialog {
return require('../Core/ReactFiberErrorDialog');
},
};