Skip to content

Provide API to check if another component is visible #44

@futpib

Description

@futpib

I'd like to scroll to a component only when it is not visible. I wish this module provided a way to perform a check for component without wrapping it.

import TrackVisibility from 'react-on-screen';

export const scrollTo = (component) => {
	if (TrackVisibility.isComponentOnScreen(component)) {
		return;
	}
	
	scrollToComponent(component);
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions