mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Reload RCTImageView when it's displaying the default image
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
This commit is contained in:
committed by
facebook-github-bot-6
parent
73b80773ba
commit
123516d556
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
@@ -63,6 +63,7 @@ RCT_TEST(IntegrationTestHarnessTest)
|
||||
RCT_TEST(TimersTest)
|
||||
RCT_TEST(AsyncStorageTest)
|
||||
RCT_TEST(AppEventsTest)
|
||||
RCT_TEST(ImageSnapshotTest)
|
||||
RCT_TEST(SimpleSnapshotTest)
|
||||
|
||||
// Disable due to flakiness: #8686784
|
||||
|
||||
BIN
Examples/UIExplorer/UIExplorerIntegrationTests/blue_square.png
Normal file
BIN
Examples/UIExplorer/UIExplorerIntegrationTests/blue_square.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 128 B |
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* 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;
|
||||
@@ -31,6 +31,7 @@ var TESTS = [
|
||||
require('./LayoutEventsTest'),
|
||||
require('./AppEventsTest'),
|
||||
require('./SimpleSnapshotTest'),
|
||||
require('./ImageSnapshotTest'),
|
||||
require('./PromiseTest'),
|
||||
];
|
||||
|
||||
|
||||
BIN
Examples/UIExplorer/UIExplorerIntegrationTests/red_square.png
Normal file
BIN
Examples/UIExplorer/UIExplorerIntegrationTests/red_square.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 129 B |
Reference in New Issue
Block a user