Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypoError: cannot read the property on undefined (reading 'div') this occur when i install react-tinder-card in my app #155

Open
Romysylva opened this issue Aug 17, 2023 · 15 comments

Comments

@Romysylva
Copy link

Romysylva commented Aug 17, 2023

Uncaught runtime errors:
×
ERROR
Cannot read properties of undefined (reading 'div')
TypeError: Cannot read properties of undefined (reading 'div')
at ./node_modules/react-tinder-card/index.js (http://localhost:3000/static/js/bundle.js:43994:30)
at options.factory (http://localhost:3000/static/js/bundle.js:53659:31)
at webpack_require (http://localhost:3000/static/js/bundle.js:53104:33)
at fn (http://localhost:3000/static/js/bundle.js:53316:21)
at ./src/components/datingCards/DatingCards.jsx (http://localhost:3000/static/js/bundle.js:102:75)
at options.factory (http://localhost:3000/static/js/bundle.js:53659:31)
at webpack_require (http://localhost:3000/static/js/bundle.js:53104:33)
at fn (http://localhost:3000/static/js/bundle.js:53316:21)
at ./src/App.js (http://localhost:3000/static/js/bundle.js:16:93)
at options.factory (http://localhost:3000/static/js/bundle.js:53659:31)

@B626
Copy link

B626 commented Aug 19, 2023

Same error

@fmhc
Copy link

fmhc commented Aug 21, 2023

same error here, too

@3DJakob
Copy link
Owner

3DJakob commented Sep 12, 2023

Are you building a react-native or react app? It looks like it's trying to import the react code in a native project 🤔 Please try to make a minimal reproducible demo and I can probably find a solution.

@thatDeryk
Copy link

using exact version "1.4.5" works for me

@nhd36
Copy link

nhd36 commented Oct 3, 2023

Any update on this error? Been stuck for 3 days now.

@a55le
Copy link

a55le commented Oct 11, 2023

Faced with the same error, switching to the previous version helped. What will the fix be waiting for from the author

@emlagowski
Copy link

emlagowski commented Oct 31, 2023

Hi, unfortunately I encountered the same error.

I tried downgrading versions one by one, and going from "react-tinder-card": "^1.6.3" to "react-tinder-card": "1.5.4" helped.

Steps to reproduce:

  1. Create app.

    npx create-expo-app test-app
    cd test-app
    npx expo install react-dom react-native-web @expo/webpack-config react-tinder-card @react-spring/[email protected] @react-spring/web
  2. Add import in App.js

    import { StatusBar } from 'expo-status-bar';
    import { StyleSheet, Text, View } from 'react-native';
    + import TinderCard from 'react-tinder-card'
  3. Run web application

    npm run web

Error in console

Uncaught TypeError: Cannot read properties of undefined (reading 'div')
    at ./node_modules/react-tinder-card/index.js (index.js:82:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./App.js (bundle.js:19:75)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./node_modules/expo/AppEntry.js (styleToBarStyle.web.ts:19:1)
    at __webpack_require__ (bootstrap:24:1)
    at startup:6:1
    at startup:6:1

BTW, great lib, thank you for your work 👍

@emlagowski
Copy link

is there any chance you can give a hint what is breaking here @3DJakob ? I can try to make a PR for this, but currently I don't know how to fix it 😞

I see that comment in your code

node_modules/react-tinder-card/index.native.js:81

// must be created outside of the TinderCard forwardRef
const AnimatedDiv = animated.div

and this throws an error ("Uncaught TypeError: Cannot read properties of undefined (reading 'div')") on web, but I don't understand why it is undefined.

@Aminetoumi0
Copy link

same issue

@tromma
Copy link

tromma commented Nov 27, 2023

I changed the version of @react-spring/web to 9.5.5, and I have no more the issue

@srose0040
Copy link

I changed the version of @react-spring/web to 9.5.5, and I have no more the issue

Same

@suigingin
Copy link

I also encountered the same error.
It is tentative, downgrade to "react-tinder-card": "1.5.4" or @react-spring/web to 9.5.5 solved this problem.
thanks guys.

@jlujan2
Copy link

jlujan2 commented Mar 26, 2024

I got this error when I run it in Docker, but when I run it in my local machines works fine. Anyone had this issue. I am using node 20.11.0

@samu975
Copy link

samu975 commented Apr 13, 2024

Hello. I solved this error with the following steps:

  1. Delete node modules and package-lock.json.
  2. Erase react-tinder-card and @react-spring/web from package.json
  3. Clean npm caché with the followin command npm cache clean --force
  4. Install all the dependencies without react-tinder-card and @react-spring/web
  5. Finally, install react-tinder-card and @react-spring/web in that order.

PD not related to this issue: @3DJakob It will be really useful add an onclick function in the interface Props in the index.d.ts.
Really awesome lib BTW

@thomyhabesha
Copy link

This fixed for me. was stuck for 2 hours and then I did:

npm uninstall @react-spring/web
npm uninstall react-tinder-card

then:
npm install --save react-tinder-card
npm install --save @react-spring/[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests