mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
React 16 beta 5 sync (5495e49...c3718c4)
Reviewed By: spicyj Differential Revision: D5564030 fbshipit-source-id: fd3e6133df7ee8e7488a3c515ce6c783c11d9401
This commit is contained in:
committed by
Facebook Github Bot
parent
b1bb0a71d5
commit
046f600cc2
@@ -68,6 +68,44 @@ jest
|
||||
};
|
||||
return DataSource;
|
||||
})
|
||||
.mock('AnimatedImplementation', () => {
|
||||
const AnimatedImplementation = require.requireActual('AnimatedImplementation');
|
||||
const oldCreate = AnimatedImplementation.createAnimatedComponent;
|
||||
AnimatedImplementation.createAnimatedComponent = function(Component) {
|
||||
const Wrapped = oldCreate(Component);
|
||||
Wrapped.__skipSetNativeProps_FOR_TESTS_ONLY = true;
|
||||
return Wrapped;
|
||||
};
|
||||
return AnimatedImplementation;
|
||||
})
|
||||
.mock('ReactNative', () => {
|
||||
const ReactNative = require.requireActual('ReactNative');
|
||||
const NativeMethodsMixin =
|
||||
ReactNative.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.NativeMethodsMixin;
|
||||
[
|
||||
'measure',
|
||||
'measureInWindow',
|
||||
'measureLayout',
|
||||
'setNativeProps',
|
||||
'focus',
|
||||
'blur',
|
||||
].forEach((key) => {
|
||||
let warned = false;
|
||||
NativeMethodsMixin[key] = function() {
|
||||
if (warned) {
|
||||
return;
|
||||
}
|
||||
warned = true;
|
||||
console.warn(
|
||||
'Calling .' + key + '() in the test renderer environment is not ' +
|
||||
'supported. Instead, mock out your components that use ' +
|
||||
'findNodeHandle with replacements that don\'t rely on the ' +
|
||||
'native environment.',
|
||||
);
|
||||
};
|
||||
});
|
||||
return ReactNative;
|
||||
})
|
||||
.mock('ensureComponentIsNative', () => () => true);
|
||||
|
||||
const mockEmptyObject = {};
|
||||
|
||||
Reference in New Issue
Block a user