From 6860fbd9cc7da5a64c7bb81bfcf14de956577711 Mon Sep 17 00:00:00 2001 From: Fang-Pen Lin Date: Sun, 15 Aug 2021 15:21:13 -0700 Subject: [PATCH] Bump ver to 2.0.0, fix react legacy methods not starting with unsafe issue --- dist/index.d.ts | 8 ++++---- dist/index.js | 8 ++++---- package.json | 4 ++-- src/index.tsx | 8 ++++---- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dist/index.d.ts b/dist/index.d.ts index 891bae09..b7febd58 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -31,8 +31,8 @@ export default class AvatarComponent extends React.Component { getChildContext(): { optionContext: OptionContext; }; - componentWillMount(): void; - componentWillReceiveProps(nextProps: Props): void; + UNSAFE_componentWillMount(): void; + UNSAFE_componentWillReceiveProps(nextProps: Props): void; render(): JSX.Element; private updateOptionContext; } @@ -44,8 +44,8 @@ export declare class Piece extends React.Component { getChildContext(): { optionContext: OptionContext; }; - componentWillMount(): void; - componentWillReceiveProps(nextProps: Props): void; + UNSAFE_componentWillMount(): void; + UNSAFE_componentWillReceiveProps(nextProps: Props): void; render(): JSX.Element; private updateOptionContext; } diff --git a/dist/index.js b/dist/index.js index e2a25b83..60583584 100644 --- a/dist/index.js +++ b/dist/index.js @@ -38,10 +38,10 @@ var AvatarComponent = /** @class */ (function (_super) { AvatarComponent.prototype.getChildContext = function () { return { optionContext: this.optionContext }; }; - AvatarComponent.prototype.componentWillMount = function () { + AvatarComponent.prototype.UNSAFE_componentWillMount = function () { this.updateOptionContext(this.props); }; - AvatarComponent.prototype.componentWillReceiveProps = function (nextProps) { + AvatarComponent.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) { this.updateOptionContext(nextProps); }; AvatarComponent.prototype.render = function () { @@ -76,10 +76,10 @@ var Piece = /** @class */ (function (_super) { Piece.prototype.getChildContext = function () { return { optionContext: this.optionContext }; }; - Piece.prototype.componentWillMount = function () { + Piece.prototype.UNSAFE_componentWillMount = function () { this.updateOptionContext(this.props); }; - Piece.prototype.componentWillReceiveProps = function (nextProps) { + Piece.prototype.UNSAFE_componentWillReceiveProps = function (nextProps) { this.updateOptionContext(nextProps); }; Piece.prototype.render = function () { diff --git a/package.json b/package.json index ba1b7b07..999b72ad 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "avataaars", - "version": "1.2.2", - "description": "React component for avataaars ", + "version": "2.0.0", + "description": "React component for avataaars", "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { diff --git a/src/index.tsx b/src/index.tsx index 3612a7b9..03f72ba8 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -40,11 +40,11 @@ export default class AvatarComponent extends React.Component { return { optionContext: this.optionContext } } - componentWillMount () { + UNSAFE_componentWillMount () { this.updateOptionContext(this.props) } - componentWillReceiveProps (nextProps: Props) { + UNSAFE_componentWillReceiveProps (nextProps: Props) { this.updateOptionContext(nextProps) } @@ -76,11 +76,11 @@ export class Piece extends React.Component { return { optionContext: this.optionContext } } - componentWillMount () { + UNSAFE_componentWillMount () { this.updateOptionContext(this.props) } - componentWillReceiveProps (nextProps: Props) { + UNSAFE_componentWillReceiveProps (nextProps: Props) { this.updateOptionContext(nextProps) }