mirror of
https://github.com/status-im/react-native.git
synced 2025-01-22 23:41:49 +00:00
123516d556
Summary: public If the frame is set, or the image view moves to a window, we should attempt to load the "real" image. The sizing logic shouldn't kick in if we're only displaying the default image. Resolves https://github.com/facebook/react-native/issues/3460. Reviewed By: tadeuzagallo Differential Revision: D2555316 fb-gh-sync-id: c0c13070ee080bad2b30ca01d9d5173bead406e3
43 lines
985 B
JavaScript
43 lines
985 B
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
'use strict';
|
|
|
|
var React = require('react-native');
|
|
var {
|
|
Image,
|
|
View,
|
|
} = React;
|
|
|
|
var { TestModule } = React.addons;
|
|
|
|
var ImageSnapshotTest = React.createClass({
|
|
componentDidMount() {
|
|
if (!TestModule.verifySnapshot) {
|
|
throw new Error('TestModule.verifySnapshot not defined.');
|
|
}
|
|
},
|
|
|
|
done(success) {
|
|
TestModule.markTestPassed(success);
|
|
},
|
|
|
|
render() {
|
|
return (
|
|
<Image
|
|
source={require('image!blue_square')}
|
|
defaultSource={require('image!red_square')}
|
|
onLoad={() => TestModule.verifySnapshot(this.done)} />
|
|
);
|
|
}
|
|
});
|
|
|
|
ImageSnapshotTest.displayName = 'ImageSnapshotTest';
|
|
|
|
module.exports = ImageSnapshotTest;
|