Skip to content

Commit

Permalink
[Fix bug]: remote style and image unload in Chrome.
Browse files Browse the repository at this point in the history
  • Loading branch information
iineva committed Sep 13, 2017
1 parent 1e109aa commit edefa02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ coverage
npm-debug.*
.idea
.nyc_output
.DS_Store
9 changes: 6 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, {PropTypes, cloneElement} from 'react';
import React, {cloneElement} from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';

const arrayLikeMap = (arrayLike, fn) => {
for (let i = 0; i < arrayLike.length; i++) {
Expand Down Expand Up @@ -109,8 +110,10 @@ export default class Print extends React.Component {
const doc = iframe.contentWindow.document;
doc.write(template);
doc.close();
iframe.contentWindow.focus();
iframe.contentWindow.print();
iframe.onload = ()=>{
iframe.contentWindow.focus();
iframe.contentWindow.print();
}
};

winPrint = (template) => {
Expand Down

0 comments on commit edefa02

Please sign in to comment.