alvarotrigo / alvarotrigo/react-fullpage

section.index in state from ReactFullpage's render parameter is not representing current section index

Đang mở
#283 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
reproduction required
Ngôn ngữ chính
JavaScript
Star
1.3k
Fork
172
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Description
I want to call a specific component on the currently displayed slide.
so Im using state to determine which slide is currently being shown.
but the state.section.index coming in the afterSlideLoad event doesn't seem to represent the index of the current section

### Link to isolated reproduction with no external CSS / JS
[Ideally in [codesandbox.io](https://codesandbox.io/s/m34yq5q0qx), links to personal websites won't be reviewed unless isolated. Reported issues without a reproduction might get closed.]

### Steps to reproduce it
1.here is part of the code
```js
{
console.error("------ FullPage Render!! : ", {state, fullpageApi})
const {initialized, direction, lastEvent, section} = state
const index = state?.destination?.index

console.error("----state.destination.index ? ", index)
console.error("section.index? ", section?.index)

const isSectionLoaded = lastEvent === 'afterLoad'
const isSlideLoaded = lastEvent === 'afterSlideLoad'
const isLightMode = direction === 'left'
const isShadowMode = direction === 'right'

return (








blah----






Feature1 - light


menu1 - test gltf load and animation version4


fullpageApi.moveSlideRight()}>go to Shadow side


{(index == 1 && isSectionLoaded) || (isSlideLoaded && isLightMode && section.index === 1) ? : null}



Feature1 - dark


fullpageApi.moveSlideLeft()}>go to Light side

{(index == 1 && isSectionLoaded) || (isSlideLoaded && isShadowMode && section.index === 1) ? () => { console.error("feature1 dark"); return null} : null}



```

2. console log capture - when I switched slide on section2
I thought section.index supposed to be index 1 which means section2
![logcapture](https://user-images.githubusercontent.com/48008003/153552089-08920e0b-33a2-4158-8300-5b2484401c19.png)

### Versions
"@fullpage/react-fullpage": "^0.1.19", -> it uses fullpage v3.1
and I run on chrome browser

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.