Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

When wrapping null nasty errors appear #5

@kirill-konshin

Description

@kirill-konshin

Starting from React 15 it is OK to return null from render function.

When this happens lib throws an error:

inview.js:51 Uncaught TypeError: Cannot read property 'getBoundingClientRect' of undefined
    at getBoundingBox (inview.js:51)
    at ReactInview.handleScroll (inview.js:135)
    at invokeFunc (debounce.js:95)
    at trailingEdge (debounce.js:142)
    at timerExpired (debounce.js:130)

So an additional check is required here https://github.com/BausCode/react-inview/blob/master/src/inview.jsx#L101 if element is falsy then abort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions