alvarotrigo / react-fullpage

Official React.js wrapper for fullPage.js https://alvarotrigo.com/react-fullpage/
GNU General Public License v3.0
1.29k stars 178 forks source link

Cannot read properties of undefined (reading 'call') #303

Open sumeet030990 opened 2 years ago

sumeet030990 commented 2 years ago

Getting error image

with little debugging found out that in render method state: {} fullpageApi: undefined image

alvarotrigo commented 2 years ago

Can you please provide an isolated reproduction in Codesandbox with no CSS or JS files external to fullPage.js and the minimum amount of HTML code. Use empty sections unless strictly necessary for reproduction.

sumeet030990 commented 2 years ago

As soon as i am importing import ReactFullpage from '@fullpage/react-fullpage'; getting the error

alvarotrigo commented 2 years ago

I cant see any error here: https://codesandbox.io/s/m34yq5q0qx

Make sure to uses the latest version 0.1.22

sumeet030990 commented 2 years ago

image PFA the video and the content.js file for your reference reactFullPage.zip

alvarotrigo commented 2 years ago

I'd prefer a reproduction in codesandbox :)

Salman-Apptware commented 2 years ago

@alvarotrigo same issue with Next js As soon as i am importing import ReactFullpage from '@fullpage/react-fullpage'; getting the error

alvarotrigo commented 2 years ago

Did you take a look at the docs regarding server rendering? https://github.com/alvarotrigo/react-fullpage#server-side-rendering

sumeet030990 commented 2 years ago

@alvarotrigo : If I am using the latest version then I am getting that error but if I switch to old version i.e. on v0.1.19 then its working properly

alvarotrigo commented 2 years ago

Interesting... do you have any URL or codesandbox I can check?

alvarotrigo commented 2 years ago

The Next demo seems to be working just fine: https://github.com/alvarotrigo/react-fullpage/tree/master/examples/next

So not quite sure how to reproduce this error on my side.

I'll wait for a reproduction before closing the issue.

AlxPE commented 2 years ago

I'm experiencing the same issue on React with dev and prod builds. image

From what I see, it's not that easy to reproduce it in codesandbox as conflict appears with webpack and a proper configuration should be added to codesandbox.

alvarotrigo commented 2 years ago

@ankitsinghaniyaz any idea what can this be?

muhammadmahad-debug commented 2 years ago
Screenshot 2022-03-27 at 2 19 14 AM

Any update I got this issue again and again

alvarotrigo commented 2 years ago

@muhammadmahad-debug you can revert back to the previous version 0.1.18 while we investigate the issue.

cskovgaard commented 2 years ago

I'm also experiencing this issue with the same error message. I am not able to reproduce the issue in codesandbox - my setup is a React app in a NX workspace with a custom webpack config. I have also tried the default NX webpack config, and it yields the same result. My versions:

Strangely enough, when reverting to 0.1.18 it can't find the module declaration: image

I don't know if there's anything I'm missing, but I guess that's also a different issue. FYI: 0.1.18 and 0.1.19, I can't find the module, and 0.1.20 and onwards I get the issue reported in this thread.

alvarotrigo commented 2 years ago

@cskovgaard doesn't seem to be related with the issue discussed on this topic. Probably a types issue?

sumeet030990 commented 2 years ago

@cskovgaard just run the command npm i --save-dev @types/fullpafe__react-fullpage most probable your issue ll be resolved

cskovgaard commented 2 years ago

@sumeet030990, unfortunately no, that package does not exist.

I was able to resolve the original issue, using version 0.1.22, after migrating my Nx-setup to the latest version. This bumped the React-version from 17.0.2 to 17.0.40, and Webpack from 4.46.0 to ^5.58.1.

Hope this can be helpful to others experiencing this problem.

pl12133 commented 2 years ago

@alvarotrigo I've also encountered this error, it seems like compatibility with Webpack 4 was lost in version @fullpage/react-fullpage@0.1.21. Everything works fine in Webpack 5.

Here is how I was able to reproduce the error:

npx create-react-app --scripts-version=4.0.0 react-fullpage-crash-test
cd react-fullpage-crash-test

npm install @fullpage/react-fullpage@0.1.21

# add the import to src/App.js
echo -e "import ReactFullpage from '@fullpage/react-fullpage';\n$(cat src/App.js)" > src/App.js

npm start
alvarotrigo commented 2 years ago

@pl12133 any solution in mind?

pl12133 commented 2 years ago

For now I think it would be enough to recommend Webpack 4 users only install 0.1.19.

I gave this a try for an hour today and messed around with the externals and library webpack config options but couldn't get anywhere. I think it's probably related to module resolution instead of the externals or output options.

I will give this another look but my app will soon be updating to Webpack 5 and that may be how we solve this on my side.

alvarotrigo commented 2 years ago

@pl12133 noted! Thanks 👍

muhammadmahad-debug commented 2 years ago

@alvarotrigo I just resolved this issue by upgrading react-scripts to V5

alvarotrigo commented 2 years ago

Thanks for letting us know @muhammadmahad-debug ! 👍

muhammadmahad-debug commented 2 years ago

@alvarotrigo Can you please release package with CARD and CARTOPTION as optional props or I can create PR for you I need it so do this ASAP

alvarotrigo commented 2 years ago

@muhammadmahad-debug done! New version 0.1.23

FrancoisSoler commented 2 years ago

Hi, i'm trying to use react Fullpage but it does not work. Once installed, I had the same issue as op, so i used "@fullpage/react-fullpage": "^0.1.19", now I have no more error except the message in console telling me to use the licenseKey prop. Weird because I had setup this with my newly purchased license. any idea ? thanks


return (
    <Box className="boxWrapper">
      <ReactFullpage
        //fullpage options
        licenseKey='XXXXX-XXXXX-XXXXX-XXXXX-XXXXX'
        scrollOverflow={true}
        render={({ state, fullpageApi }) => {
          return (
            <ReactFullpage.Wrapper>
              {posts.map(({ key, link, isLast, Wrapper, i }) => (
                <Wrapper key={key} className="wrapperPost">
                  <Box className="section">
                    <Post
                      post={post}
                      postData={postData}
                      link={link}
                      isLast={isLast}
                      key={key}
                    />
                  </Box>

                  {!isLast && <hr />}
                </Wrapper>
              ))}
            </ReactFullpage.Wrapper>
          );
        }}
      />
      <Container
        css={css`
          background: ${bgColorArticle};
        `}
      >
        {isFetching && <Loading />}
        {(isLimit || isError) && (
          <Button
            onClick={fetchNext}
            css={css`
              background: ${colorsHover};
              transition: all 0.3s ease-in-out;
              &:hover {
                transform: scale(0.9);
              }
            `}
          >
            {isError ? "Essayer à nouveau" : "Charger plus"}
          </Button>
        )}
      </Container>
    </Box>
  );
};
alvarotrigo commented 2 years ago

so i used "@fullpage/react-fullpage": "^0.1.19",

Try updating to the latest version react-fullpage 0.1.27

FrancoisSoler commented 2 years ago

so i used "@fullpage/react-fullpage": "^0.1.19",

Try updating to the latest version react-fullpage 0.1.27

Thanks for the very fast response, but has I said if I use the last version same message as op is displayed. there is no work around beside update webpack ?

alvarotrigo commented 2 years ago

@FrancoisSoler It seems like so. If you prefer to use an older version like 0.1.19 use the contact form to ask for a license key for fullPage.js v3 (current is v4). However, note that will not get maintained nor updated anymore.

FrancoisSoler commented 2 years ago

thanks for your help

Bilal-Bangash commented 1 year ago

@alvarotrigo image getting same error

my current package.json looks like image

OS : Windows 10 Node Versions I tried: 16.13.1, 14.16.0, 18.2.0

cskovgaard commented 1 year ago

@Bilal-Bangash, try updating your version of react-scripts to 4+

Bilal-Bangash commented 1 year ago

@Bilal-Bangash, try updating your version of react-scripts to 4+ @cskovgaard Yes, Thank you I updated react-scripts. It is working now