here's a material ui template which has a problem at small screensizes, scrollbar may not appear until you click on the table and in the console this appears:
error exists in the node modules but I don't really feel it could be fixed by modifying the node modules file but by changing the component's jsx so all solutions I found online were setting the 'touchStart' to passive and I don't feel that's the solution but we need a solution in the component itself
and I don't know how to fix it in the component itself and here's the component:
const LatestOrders = ({ className, ...rest }) => {
const classes = useStyles();
const [orders] = useState(data);
return (
<Card
className={clsx(classes.root, className)}
{...rest}
>
<CardHeader title="Latest Orders" />
<Divider />
<PerfectScrollbar>
<Box minWidth={800}>
<Table>
<TableHead>
<TableRow>
<TableCell>
Order Ref
</TableCell>
<TableCell>
Customer
</TableCell>
<TableCell sortDirection="desc">
<Tooltip
enterDelay={300}
title="Sort"
>
<TableSortLabel
active
direction="desc"
>
Date
</TableSortLabel>
</Tooltip>
</TableCell>
<TableCell>
Status
</TableCell>
</TableRow>
</TableHead>
<TableBody>
{orders.map((order) => (
<TableRow
hover
key={order.id}
>
<TableCell>
{order.ref}
</TableCell>
<TableCell>
{order.customer.name}
</TableCell>
<TableCell>
{moment(order.createdAt).format('DD/MM/YYYY')}
</TableCell>
<TableCell>
<Chip
color="primary"
label={order.status}
size="small"
/>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</Box>
</PerfectScrollbar>
<Box
display="flex"
justifyContent="flex-end"
p={2}
>
<Button
color="primary"
endIcon={<ArrowRightIcon />}
size="small"
variant="text"
>
View all
</Button>
</Box>
</Card>
);
};
LatestOrders.propTypes = {
className: PropTypes.string
};
I ran into the same issue and fixed it by adding style={{ touchAction: "none" }}
to the ScrollBar
component.
import ScrollBar from "react-perfect-scrollbar";
<ScrollBar style={{ touchAction: "none" }}>
...
</ScrollBar>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With