Skip to content

Commit c07bdaf

Browse files
authored
Merge pull request #186 from oleksandr-danylchenko/#185-restore-android-popup
#185 Fixed popup rendering on Android
2 parents fe3ecc5 + e15ea2e commit c07bdaf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/text-annotator-react/src/TextAnnotationPopup/TextAnnotationPopup.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,18 @@ export const TextAnnotationPopup = (props: TextAnnotationPopupProps) => {
9393
const { getFloatingProps } = useInteractions([dismiss, role]);
9494

9595
useEffect(() => {
96-
if (annotation?.id) {
96+
if (!r) return;
97+
98+
const annotationId = annotation?.id;
99+
const annotationSelectorsLength = annotation?.target.selector.length;
100+
101+
if (annotationId && annotationSelectorsLength > 0) {
97102
const bounds = r?.state.store.getAnnotationBounds(annotation.id);
98103
setOpen(Boolean(bounds));
99104
} else {
100105
setOpen(false);
101106
}
102-
}, [annotation?.id, r?.state.store]);
107+
}, [annotation?.id, annotation?.target.selector, r?.state.store]);
103108

104109
useEffect(() => {
105110
if (!r) return;

0 commit comments

Comments
 (0)