mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-26 18:53:19 +08:00
Migrate "Libraries" from Haste to standard path-based requires (sans vendor & renderers) (#24749)
Summary: This is the next step in moving RN towards standard path-based requires. All the requires in `Libraries` have been rewritten to use relative requires with a few exceptions, namely, `vendor` and `Renderer/oss` since those need to be changed upstream. This commit uses relative requires instead of `react-native/...` so that if Facebook were to stop syncing out certain folders and therefore remove code from the react-native package, internal code at Facebook would not need to change. See the umbrella issue at https://github.com/facebook/react-native/issues/24316 for more detail. [General] [Changed] - Migrate "Libraries" from Haste to standard path-based requires Pull Request resolved: https://github.com/facebook/react-native/pull/24749 Differential Revision: D15258017 Pulled By: cpojer fbshipit-source-id: a1f480ea36c05c659b6f37c8f02f6f9216d5a323
This commit is contained in:
committed by
Facebook Github Bot
parent
59749f527a
commit
0ee5f68929
@@ -9,14 +9,14 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const DeprecatedColorPropType = require('DeprecatedColorPropType');
|
||||
const Platform = require('Platform');
|
||||
const React = require('React');
|
||||
const StyleSheet = require('StyleSheet');
|
||||
const DeprecatedColorPropType = require('../../DeprecatedPropTypes/DeprecatedColorPropType');
|
||||
const Platform = require('../../Utilities/Platform');
|
||||
const React = require('react');
|
||||
const StyleSheet = require('../../StyleSheet/StyleSheet');
|
||||
|
||||
const RCTInputAccessoryViewNativeComponent = require('RCTInputAccessoryViewNativeComponent');
|
||||
const RCTInputAccessoryViewNativeComponent = require('./RCTInputAccessoryViewNativeComponent');
|
||||
|
||||
import type {ViewStyleProp} from 'StyleSheet';
|
||||
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
||||
|
||||
/**
|
||||
* Note: iOS only
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
import type {NativeComponent} from 'ReactNative';
|
||||
import type {ColorValue} from 'StyleSheetTypes';
|
||||
import type {ViewStyleProp} from 'StyleSheet';
|
||||
import type {NativeComponent} from '../../Renderer/shims/ReactNative';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
|
||||
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
||||
|
||||
const React = require('React');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
const React = require('react');
|
||||
const requireNativeComponent = require('../../ReactNative/requireNativeComponent');
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
+children: React.Node,
|
||||
|
||||
@@ -9,31 +9,31 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
const DeprecatedColorPropType = require('DeprecatedColorPropType');
|
||||
const DeprecatedViewPropTypes = require('DeprecatedViewPropTypes');
|
||||
const DocumentSelectionState = require('DocumentSelectionState');
|
||||
const NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
const Platform = require('Platform');
|
||||
const DeprecatedColorPropType = require('../../DeprecatedPropTypes/DeprecatedColorPropType');
|
||||
const DeprecatedViewPropTypes = require('../../DeprecatedPropTypes/DeprecatedViewPropTypes');
|
||||
const DocumentSelectionState = require('../../vendor/document/selection/DocumentSelectionState');
|
||||
const NativeMethodsMixin = require('../../Renderer/shims/NativeMethodsMixin');
|
||||
const Platform = require('../../Utilities/Platform');
|
||||
const PropTypes = require('prop-types');
|
||||
const React = require('React');
|
||||
const ReactNative = require('ReactNative');
|
||||
const StyleSheet = require('StyleSheet');
|
||||
const Text = require('Text');
|
||||
const TextAncestor = require('TextAncestor');
|
||||
const TextInputState = require('TextInputState');
|
||||
const TouchableWithoutFeedback = require('TouchableWithoutFeedback');
|
||||
const UIManager = require('UIManager');
|
||||
const React = require('react');
|
||||
const ReactNative = require('../../Renderer/shims/ReactNative');
|
||||
const StyleSheet = require('../../StyleSheet/StyleSheet');
|
||||
const Text = require('../../Text/Text');
|
||||
const TextAncestor = require('../../Text/TextAncestor');
|
||||
const TextInputState = require('./TextInputState');
|
||||
const TouchableWithoutFeedback = require('../Touchable/TouchableWithoutFeedback');
|
||||
const UIManager = require('../../ReactNative/UIManager');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const invariant = require('invariant');
|
||||
const requireNativeComponent = require('requireNativeComponent');
|
||||
const requireNativeComponent = require('../../ReactNative/requireNativeComponent');
|
||||
const warning = require('fbjs/lib/warning');
|
||||
|
||||
import type {TextStyleProp, ViewStyleProp} from 'StyleSheet';
|
||||
import type {ColorValue} from 'StyleSheetTypes';
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
import type {SyntheticEvent, ScrollEvent} from 'CoreEventTypes';
|
||||
import type {PressEvent} from 'CoreEventTypes';
|
||||
import type {TextStyleProp, ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
import type {SyntheticEvent, ScrollEvent} from '../../Types/CoreEventTypes';
|
||||
import type {PressEvent} from '../../Types/CoreEventTypes';
|
||||
|
||||
let AndroidTextInput;
|
||||
let RCTMultilineTextInputView;
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const Platform = require('Platform');
|
||||
const UIManager = require('UIManager');
|
||||
const Platform = require('../../Utilities/Platform');
|
||||
const UIManager = require('../../ReactNative/UIManager');
|
||||
|
||||
let currentlyFocusedID: ?number = null;
|
||||
const inputs = new Set();
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const React = require('React');
|
||||
const View = require('View');
|
||||
const InputAccessoryView = require('InputAccessoryView');
|
||||
const React = require('react');
|
||||
const View = require('../../View/View');
|
||||
const InputAccessoryView = require('../InputAccessoryView');
|
||||
const render = require('../../../../jest/renderer');
|
||||
|
||||
describe('<InputAccessoryView />', () => {
|
||||
@@ -36,7 +36,7 @@ describe('<InputAccessoryView />', () => {
|
||||
});
|
||||
|
||||
it('should shallow render as <InputAccessoryView> when not mocked', () => {
|
||||
jest.dontMock('InputAccessoryView');
|
||||
jest.dontMock('../InputAccessoryView');
|
||||
|
||||
const output = render.shallow(
|
||||
<InputAccessoryView nativeID="1">
|
||||
@@ -47,7 +47,7 @@ describe('<InputAccessoryView />', () => {
|
||||
});
|
||||
|
||||
it('should render as <RCTInputAccessoryView> when not mocked', () => {
|
||||
jest.dontMock('InputAccessoryView');
|
||||
jest.dontMock('../InputAccessoryView');
|
||||
|
||||
const instance = render.create(
|
||||
<InputAccessoryView nativeID="1">
|
||||
|
||||
@@ -11,15 +11,15 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
const React = require('React');
|
||||
const React = require('react');
|
||||
const ReactTestRenderer = require('react-test-renderer');
|
||||
const TextInput = require('TextInput');
|
||||
const TextInput = require('../TextInput');
|
||||
|
||||
import Component from '@reactions/component';
|
||||
|
||||
const {enter} = require('ReactNativeTestTools');
|
||||
const {enter} = require('../../../Utilities/ReactNativeTestTools');
|
||||
|
||||
jest.unmock('TextInput');
|
||||
jest.unmock('../TextInput');
|
||||
|
||||
describe('TextInput tests', () => {
|
||||
let input;
|
||||
|
||||
Reference in New Issue
Block a user