From 8eaa28a31891a068b1458048f46c25fac307caec Mon Sep 17 00:00:00 2001 From: Joshua Efiong Date: Mon, 12 Sep 2016 15:59:50 +0100 Subject: [PATCH] Add auto change radius to Circle --- src/Circle.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Circle.tsx b/src/Circle.tsx index d975c43..2c0c575 100644 --- a/src/Circle.tsx +++ b/src/Circle.tsx @@ -45,6 +45,10 @@ export class Circle extends React.Component { lng: nextProps.lng, }); } + + if (nextProps.radius !== this.props.radius) { + this.setRadius(nextProps.radius); + } } public render(): JSX.Element { @@ -93,6 +97,11 @@ export class Circle extends React.Component { const { circle } = this; circle.setCenter(point); } + + private setRadius(radius: number): void { + const { circle } = this; + circle.setRadius(radius); + } } // make the Circle component the default export