aos icon indicating copy to clipboard operation
aos copied to clipboard

not working correctly with Next.js 13.4.19

Open R3ps4k opened this issue 2 years ago • 7 comments

After upgrading project to newest release of nextjs everything stopped working. Not a single element with aos property got rendered (animation was not triggered).

Downgrading it back to 13.4.6 solved the issue

This is:

  • Bug

Specifications

  • AOS version: 2.3.4
  • OS: Windows/linux
  • Browser: chrome, edge, firefox

Expected Behavior

Animations should be triggered

Actual Behavior

not a single animation was triggered resulting in unusable website

Steps to Reproduce the Problem

  1. setup nextjs project and add aos
  2. Initialize aos with AOS.init
  3. add any animation to site element
  4. result - element is not visible on the site

Detailed Description

Possible Solution

R3ps4k avatar Sep 17 '23 18:09 R3ps4k

NextJS version 13.5 was released short time ago. Does this behaviour still exist on the newest NextJS Version? In my opinion it could be a NextJS bug maybe?

DanielOberlechner avatar Oct 01 '23 11:10 DanielOberlechner

I faced the same issue in next.js version 13+ and I did correctly the installation and It didn't work properly on my end!

jsvelte avatar Oct 14 '23 12:10 jsvelte

I personally shifted from AOS to animejs which is a far better library to also a bit more complex ... maybe that would be a solution for both of you? :)

Keep in mind last commit was October 2018 ...

DanielOberlechner avatar Oct 14 '23 21:10 DanielOberlechner

I fixed my issue please refer here https://github.com/shadcn-ui/ui/issues/1745

jsvelte avatar Oct 15 '23 01:10 jsvelte

same issue in next.js 14.0.4

bdhamithkumara avatar Feb 21 '24 18:02 bdhamithkumara

A solution that worked for me was adding a slight delay in initializing AOS (Next.js 14.1.0): image

ABCodez avatar Mar 19 '24 17:03 ABCodez

In my case the problem was that all the images were by default lazy loaded. To solve the issue I had to create an Image component that refreshed the AOS as soon as the image finished loading, and then I used this component across the app instead of the next/image one.

This is the piece of code that I used:

"use client";

import AOS from "aos";
import ImageComponent, { ImageProps } from "next/image";

export function Image(props: ImageProps) {
  return (
    <ImageComponent
      {...props}
      onLoad={() => AOS.refresh()}
    />
  )
}

Harukisatoh avatar Jul 05 '24 13:07 Harukisatoh