Skip to content

Commit

Permalink
Merge pull request #299 from gregnb/v/2.10.2
Browse files Browse the repository at this point in the history
v2.10.2
  • Loading branch information
MatthewHerbst authored Oct 16, 2020
2 parents 86e0efc + 1d13cef commit dab3e22
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 20 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 2.10.2 (October 16th, 2020)

- FIX [298](https://github.com/gregnb/react-to-print/pull/298): Fixes a long-standing issue of checkbox state not always copying properly into the print window. Thanks [aviklai](https://github.com/aviklai)
- CHORE: update patch and minor `devDependencies`, `dedupe`, and `audit fix`

## 2.10.1 (October 15th, 2020)

- FIX [296](https://github.com/gregnb/react-to-print/pull/296): Ensure `bodyClass` can handle multiple class names instead of just a single class name. Thanks [seanblonien](https://github.com/seanblonien)
Expand Down
22 changes: 20 additions & 2 deletions example/ComponentToPrint/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ type Props = { // tslint:disable-line interface-over-type-literal
text: string,
};

export class ComponentToPrint extends React.PureComponent<Props> {
type State = {
checked: boolean,
};

export class ComponentToPrint extends React.PureComponent<Props, State> {
constructor(props: Props) {
super(props);

this.state = { checked: false };
}

private canvasEl!: HTMLCanvasElement;

public componentDidMount() {
Expand All @@ -16,6 +26,8 @@ export class ComponentToPrint extends React.PureComponent<Props> {
}
}

private handleCheckboxOnClick = () => this.setState({ checked: !this.state.checked });

private setRef = (ref: HTMLCanvasElement) => this.canvasEl = ref;

public render() {
Expand All @@ -33,7 +45,13 @@ export class ComponentToPrint extends React.PureComponent<Props> {
<tbody>
<tr>
<td>{this.props.text}</td>
<td>2</td>
<td>
<input
checked={this.state.checked}
onClick={this.handleCheckboxOnClick}
type="checkbox"
/>
</td>
</tr>
<tr>
<td>3</td>
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-to-print",
"version": "2.10.1",
"version": "2.10.2",
"description": "Print React components in the browser",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -40,7 +40,7 @@
"prop-types": "^15.7.2"
},
"devDependencies": {
"@types/react": "^16.9.52",
"@types/react": "^16.9.53",
"@types/react-dom": "^16.9.8",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
Expand All @@ -50,7 +50,7 @@
"eslint": "^7.11.0",
"html-webpack-plugin": "^4.5.0",
"husky": "^4.3.0",
"lint-staged": "^10.4.0",
"lint-staged": "^10.4.1",
"react": "^16.8.4",
"react-dom": "^16.8.4",
"style-loader": "^1.2.1",
Expand Down
8 changes: 0 additions & 8 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,5 @@
},
"include": [
"./src"
],
"exclude": [
"dist",
"lib",
"node_modules",
"webpack.config.js",
"webpack.dev.config.js",
"webpack.prod.config.js"
]
}

0 comments on commit dab3e22

Please sign in to comment.