Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactSwipeRefreshLayout cannot be cast #8

Open
geo-vi opened this issue Feb 7, 2021 · 4 comments
Open

ReactSwipeRefreshLayout cannot be cast #8

geo-vi opened this issue Feb 7, 2021 · 4 comments

Comments

@geo-vi
Copy link

geo-vi commented Feb 7, 2021

An interesting issue popped up today while using 0.0.5 version

image

@geo-vi geo-vi changed the title ReactSwipeRefresn ReactSwipeRefresn h Feb 7, 2021
@geo-vi geo-vi changed the title ReactSwipeRefresn h ReactSwipeRefreshLayout cannot be cast Feb 7, 2021
@geo-vi
Copy link
Author

geo-vi commented Feb 10, 2021

The workaround this was:

    componentDidMount() {
        this.setState({visibleRefreshControl: true})
    }

    render() {
        const { visibleRefreshControl } = this.state;

        return (<FlatList
            //...
            refreshControl={visibleRefreshControl ? refreshControl : null}
        />);
    }

Pretty interestingly what happens is actually findNodeHandle provided by react-native gets the RefreshControl node and attempts to cast it :? Pretty strange one indeed

@geo-vi
Copy link
Author

geo-vi commented Feb 10, 2021

After some fine digging I found out a lot cleaner way of doing stuff

  • const viewTag = flRef.current.getScrollableNode(); instead of findNodeHandle(flRef.current);

Reason for that change is basically it guarantees to retrieve always the correct scrolling ref and not some of the outer ones.

I'll do a PR with this change

@vishalnarkhede
Copy link
Collaborator

vishalnarkhede commented Feb 13, 2021

@geo-vi thanks alot for investigating this. I will be able to look into this after wednesday. Will get back :)

I can see that you raised a PR as well, could you please sync with latest main branch? Some major changes were introduced as part of latest release.

@geo-vi
Copy link
Author

geo-vi commented Feb 14, 2021

Already did ))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants