From 2c01691b2dbcd6df7ad84b09101c2d2c8d7d2bb7 Mon Sep 17 00:00:00 2001 From: Taylor Lapeyre Date: Mon, 12 Apr 2021 15:48:02 -0700 Subject: [PATCH] use props instead of type.name to tell Annotation components --- src/lib/Annotation.js | 5 +++-- src/lib/AppleMaps.js | 8 ++++---- src/lib/ImageAnnotation.js | 3 ++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/lib/Annotation.js b/src/lib/Annotation.js index 7f619b4..71f4204 100644 --- a/src/lib/Annotation.js +++ b/src/lib/Annotation.js @@ -1,11 +1,12 @@ import React, { Fragment } from 'react' -const Annotation = () => { +function Annotation() { return } Annotation.defaultProps = { - visible: true + visible: true, + isAnnotation: true } export default Annotation diff --git a/src/lib/AppleMaps.js b/src/lib/AppleMaps.js index 3597875..905a9f7 100644 --- a/src/lib/AppleMaps.js +++ b/src/lib/AppleMaps.js @@ -16,12 +16,12 @@ class AppleMaps extends Component { // Annotations if (children !== undefined && children.length) { children.forEach(child => { - if (child.type.name === 'Annotation') { + if (child.props.isAnnotation) { this.createAnnotation(child.props) } }) } else if (children !== undefined && children.props) { - if (children.type.name === 'Annotation') { + if (children.props.isAnnotation) { this.createAnnotation(children.props) } } @@ -29,12 +29,12 @@ class AppleMaps extends Component { // Image Annotations if (children !== undefined && children.length) { children.forEach(child => { - if (child.type.name === 'ImageAnnotation') { + if (child.props.isImageAnnotation) { this.createImageAnnotation(child.props) } }) } else if (children !== undefined && children.props) { - if (children.type.name === 'ImageAnnotation') { + if (children.props.isImageAnnotation) { this.createImageAnnotation(children.props) } } diff --git a/src/lib/ImageAnnotation.js b/src/lib/ImageAnnotation.js index bacc5b4..cf8eee9 100644 --- a/src/lib/ImageAnnotation.js +++ b/src/lib/ImageAnnotation.js @@ -5,7 +5,8 @@ const ImageAnnotation = () => { } ImageAnnotation.defaultProps = { - visible: true + visible: true, + isImageAnnotation: true } export default ImageAnnotation