alvarotrigo / react-fullpage

Official React.js wrapper for fullPage.js https://alvarotrigo.com/react-fullpage/
GNU General Public License v3.0
1.28k stars 179 forks source link

Child component containing 'sections' doesn't work when rendered via renderItems #410

Closed chrisedington closed 1 year ago

chrisedington commented 1 year ago

Description

I'm using React Native Web (everything seems to work fine with fullpage.js), however I have a FlatList component inside the ReactFullpage component.

When I move the div sections into the main component, directly underneath the ReactFullpage, everything works fine.

However when using FlatList's renderItem which loads another component (the list of images for example) that contains the div sections, they cannot be found, and one sees the expected errors:

Cannot read properties of null (reading 'index')
Cannot read properties of undefined (reading 'destroy')

So I guess it's more of a generic question, not a bug related to Fullpage.js, but is there a way I can get div sections to work if they are contained in child components that are rendered by method like RenderItem?

alvarotrigo commented 1 year ago

So I guess it's more of a generic question, not a bug related to Fullpage.js, but is there a way I can get div sections to work if they are contained in child components that are rendered by method like RenderItem?

Nope. fullPage.js requires certain structure:

<div id="fullpage">
    <div class="section">Some section</div>
    <div class="section">Some section</div>
    <div class="section">Some section</div>
    <div class="section">Some section</div>
</div>

Sections can't be wrapped.