Git Product home page Git Product logo

react-dom-box2d's People

Contributors

nagarajansnapwiz avatar oneto018 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-dom-box2d's Issues

Cannot read properties of undefined (reading 'props')

Can't get this to work with React v18. Page just spits this:

ERROR
Cannot read properties of undefined (reading 'props')
TypeError: Cannot read properties of undefined (reading 'props')
    at e.value (http://localhost:3000/static/js/bundle.js:17275:37)
    at finishClassComponent (http://localhost:3000/static/js/bundle.js:36183:35)
    at updateClassComponent (http://localhost:3000/static/js/bundle.js:36140:28)
    at beginWork (http://localhost:3000/static/js/bundle.js:37766:20)
    at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/bundle.js:22757:18)
    at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/bundle.js:22801:20)
    at invokeGuardedCallback (http://localhost:3000/static/js/bundle.js:22858:35)
    at beginWork$1 (http://localhost:3000/static/js/bundle.js:42732:11)
    at performUnitOfWork (http://localhost:3000/static/js/bundle.js:41979:16)
    at workLoopSync (http://localhost:3000/static/js/bundle.js:41902:9)

issues with react dom 17

hi, i cannot get a simlpe demo running with react17 and react-dom 17.

Unhandled Runtime Error
Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.

Call Stack
resolveDispatcher
node_modules/react-dom-box2d/node_modules/react/cjs/react.development.js (1465:0)
useEffect
node_modules/react-dom-box2d/node_modules/react/cjs/react.development.js (1508:0)
z
node_modules/react-dom-box2d/build/index.js (1:342523)

ReferenceError: regeneratorRuntime is not defined

When I tried the following code:

import React from 'react'
import { World, Item } from 'react-dom-box2d'
import '/styles/langs.css'

// ...
return (
        <World gravity={[0, 9.8]}>
          {codes.map((code, i) => (
            <Item restitution={0.8} key={i}>
              <figure>
                <div className="picDesc">
                  <figcaption>
                    <h3 onClick={() => open(code.html_url)}>
                      {code.fork && <span>[Fork]</span>} {code.name}{code.stargazers_count}
                    </h3>
                    <span>
                      Language: <span className={'lang ' + code.language}>{code.language}</span>
                    </span>
                  </figcaption>
                  {code.description}
                </div>
              </figure>
            </Item>
          ))}
        </World>
       )
// ...

it threw an error that I didn't import regeneratorRuntime but it isn't listed in required packages of this component. So please add it to package.json or fix in another way because I have to install and import that dependency manually and this is not cool.

Add drag n drop

This would be a cool feature because most of the js physics libraries have it.

Maybe we could have a special prop, e.g. dnd={true} for both World in case we want to make every element draggable, and for Item, if we only want item to be dragged.

Example proposal:

<World gravity={[0, 9.8]} dnd>
  <Item dnd />
</World>

I made a fork and I'll try to implement this feature using ClientX and ClientY and then submit a PR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.