Estoy tratando de hacer que scrollTo funcione, pero por otras preguntas que he visto, tiene que ver con mi css, sin embargo, ninguna de las soluciones que encontré funcionó.
Estoy usando componentes de reacción y estilo y el desplazamiento está en el eje X
aquí está la reacción:
return ( <StyledBoard container> <StyledGrid> <StyledScroll> <StyledScrollWrapper> {data.map((category, i) => ( {content} ))} </StyledScrollWrapper> </StyledScroll> </StyledGrid> </StyledBoard> );aquí está el estilo:
import styled from "styled-components"; import Grid from "@mui/material/Grid"; import Card from "@mui/material/Card"; import SimpleBar from "simplebar-react"; const StyledBoard = styled(Grid)` margin-top: 20px !important; margin-bottom: 8px !important; display: flex; flex-flow: row nowrap; overflow: auto; `; const StyledGrid = styled.div` width: 100%; display: flex; `; const StyledScroll = styled(SimpleBar)` height: calc(100vh - 265px); width: 100%; .simplebar-wrapper { height: 100%; } .simplebar-content { height: 100%; } .simplebar-scrollbar::before { background-color: ${({ theme }) => theme.colours.primary}; } `; const StyledScrollWrapper = styled.div` display: flex; width: auto; `;