Introduce SnapshotView which wraps Renderable content and will verify the snapshot

Reviewed By: @javache

Differential Revision: D2493722
This commit is contained in:
Dave Miller
2015-10-02 12:13:48 -07:00
committed by facebook-github-bot-3
parent de736227fa
commit b8c42f7f6f
6 changed files with 128 additions and 11 deletions

View File

@@ -19,11 +19,10 @@ var React = require('react-native');
var {
AppRegistry,
Settings,
SnapshotView,
StyleSheet,
} = React;
var { TestModule } = React.addons;
import type { NavigationContext } from 'NavigationContext';
var UIExplorerListBase = require('./UIExplorerListBase');
@@ -83,17 +82,13 @@ var APIS = [
COMPONENTS.concat(APIS).forEach((Example) => {
if (Example.displayName) {
var Snapshotter = React.createClass({
componentDidMount: function() {
// View is still blank after first RAF :\
global.requestAnimationFrame(() =>
global.requestAnimationFrame(() => TestModule.verifySnapshot(
TestModule.markTestPassed
)
));
},
render: function() {
var Renderable = UIExplorerListBase.makeRenderable(Example);
return <Renderable />;
return (
<SnapshotView>
<Renderable />
</SnapshotView>
);
},
});
AppRegistry.registerComponent(Example.displayName, () => Snapshotter);