project_travel_advisor icon indicating copy to clipboard operation
project_travel_advisor copied to clipboard

Scroll Into View

Open ghost opened this issue 3 years ago • 8 comments

Hey, there Adrian! Don't know why is this happening

ScrollIntoView is not working

I`ve re-write the code couple of times by going back into the video where you start explaining CHILD CLICKED

CHILD CLICKED IS WORKING as shown in console.log

but after that when you explain if(selected) refProp?.current?.scrollIntoView({ behavior:'smooth', block:'start' })

everything runs except child click stops and the scroll does not work when clicked

ghost avatar Feb 01 '22 08:02 ghost

Replace your code to this where you're rendering your PlaceDetails component <Grid ref={elRefs[i]} key={i} item xs={12}> <PlaceDetails selected={Number(childClicked) === i} refProp={elRefs[i]} place={place} /> </Grid>

In the video, he deleted ref={elRefs[i]} but is required.

gr8guyrabi avatar Feb 03 '22 07:02 gr8guyrabi

Guys i have done everything asked here and still my scroll doesnt work similar to @Shubham-Sakhare any help is appreciated.

dhananjaybhandiwad avatar Feb 25 '22 22:02 dhananjaybhandiwad

Guys i have done everything asked here and still my scroll doesnt work similar to @Shubham-Sakhare any help is appreciated.

did you try using the apporach above?

gr8guyrabi avatar Mar 01 '22 04:03 gr8guyrabi

bitmoji

Thanks @gr8guyrabi , that worked like a charm.

Rallanvila avatar Mar 14 '22 03:03 Rallanvila

Replace your code to this where you're rendering your PlaceDetails component <Grid ref={elRefs[i]} key={i} item xs={12}> <PlaceDetails selected={Number(childClicked) === i} refProp={elRefs[i]} place={place} /> </Grid>

In the video, he deleted ref={elRefs[i]} but is required.

Thanks Bro! works like a charm.

sanidhyy avatar Jun 20 '22 05:06 sanidhyy

Replace your code to this where you're rendering your PlaceDetails component <Grid ref={elRefs[i]} key={i} item xs={12}> <PlaceDetails selected={Number(childClicked) === i} refProp={elRefs[i]} place={place} /> </Grid>

In the video, he deleted ref={elRefs[i]} but is required.

Excelent! it works!!!!!

GeomaticaNet avatar Sep 17 '22 19:09 GeomaticaNet

Replace your code to this where you're rendering your PlaceDetails component <Grid ref={elRefs[i]} key={i} item xs={12}> <PlaceDetails selected={Number(childClicked) === i} refProp={elRefs[i]} place={place} /> </Grid>

In the video, he deleted ref={elRefs[i]} but is required.

It is working but not creating similar effect like that in video.

RISHABH2407 avatar Apr 25 '23 18:04 RISHABH2407

Thanks @gr8guyrabi . Lobe you💋

shivendra8004 avatar May 07 '23 11:05 shivendra8004