mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-26 07:04:05 +08:00
Introduce SnapshotView which wraps Renderable content and will verify the snapshot
Reviewed By: @javache Differential Revision: D2493722
This commit is contained in:
committed by
facebook-github-bot-3
parent
de736227fa
commit
b8c42f7f6f
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user