christianalfoni / formsy-react

A form input builder and validator for React JS
MIT License
2.6k stars 436 forks source link

Support React v16.0 #481

Open olex-green opened 7 years ago

olex-green commented 7 years ago

React v16.0 has been released with massive improvements.

Kaishiyoku commented 7 years ago

The blog post is saying that there aren't many breaking changes when coming from 15.6 (https://facebook.github.io/react/blog/2017/09/26/react-v16.0.html#upgrading)

twisty commented 7 years ago

Is this just a matter of adding || ^16.0.0 to the peerDependencies?

https://github.com/christianalfoni/formsy-react/blob/ebd84bb02613b355a02fd3e3cffb9d6dcd46b500/package.json#L47

That should be okay for the upcoming 1.0.x release, but the 0.x releases use mixins – are they supported in React 16?

twisty commented 7 years ago

The current release of the beta on npm has React v15 listed as a dependency. If you upgrade your app to React v16, two versions of React are loaded and chaos ensues.

https://github.com/christianalfoni/formsy-react/blob/998e2be44f4dcf3c49162244a4ef9e813af6f5c3/package.json

As this has already been fixed on the beta branch, is there any word on pushing a new release to npm?

Jareechang commented 7 years ago

whats the road map right now ? I would love to contribute and make updates but this project seems pretty in-active.

screen shot 2017-09-28 at 12 30 13 pm

kernel72 commented 7 years ago

There is another repo presents on Github - fork of this one. https://github.com/maccuaa/formsy-react-2. It looks like ready for React 16. AFAIK it was made because of low activity of this one repo. I have tried it in my projects, and looks like ok.

Kaishiyoku commented 7 years ago

Thanks for the link to the fork! Will look forward to it. It's sad that there hasn't happened much recently.

aogaili commented 7 years ago

The other repo doesn't seem to work with formsy-react-components I hope this repo get updated.

@twisty what's your take on this?

twisty commented 7 years ago

Hi @aliogaili, (Speaking as the maintainer of the formsy-react-components package). I'm not keen to support forks of formsy-react right now.

I agree the stuttered release pattern of formsy-react is frustrating, especially when we want to test with the latest shiny new React. But there is some nice stuff on the beta branch that seems like it could reboot this project, and I'd like to support that before switching to or otherwise supporting forks.

Note: I'm not passing any judgment or expressing a preference about any forks here. It's just easier for consumers of formsy-react-components to couple with the formsy-react mothership.

aogaili commented 7 years ago

Thanks @twisty, I also think that's the right path. Looking forward for more releases from formsy-reactand formsy-react-components :)

maccuaa commented 7 years ago

I agree, I would rather contribute to this project than have to maintain a fork.

Azerothian commented 6 years ago

I think i need to put it out there that react-formsy in its current state works fine with React 16.

Tested with a basic form and a custom HOC class based textfield control

aogaili commented 6 years ago

I'm running into the following error when I update to React 16:

screen shot 2017-10-06 at 7 17 25 am

Any idea on what might be causing this?

aogaili commented 6 years ago

Ok I went to the node_modules/formsy-react/node_modules and deleted the react folder and the error went away! when I do npm install again, the folder gets recreated (with react react@15.6.2) and the error comes back. I'm using NPM 5.4.2.

Does anyone know what might be causing this behavior? This might be trivial question, but how are you guys installing the beta version? are using the beta tag from npm?

When I do npm install formsy-react@beta npm downloads the package.json file below which has "react": "^15.0.0" as dependency, then npm will install react15 under the formsy-react node_modules folder which will get loaded at the client and result in the equeueCallback exception..am I missing something here?

{
  "_from": "formsy-react@beta",
  "_id": "formsy-react@1.0.0",
  "_inBundle": false,
  "_integrity": "sha512-anFitmAKhZ9XK7lfkzxy1ugl+Tyn7mR3tkFsI8KkLCKRUL2nY8hpUWvTgczTaqzvqROc95+bCRuWoJ79ZyJqtA==",
  "_location": "/formsy-react",
  "_phantomChildren": {
    "create-react-class": "15.6.2",
    "fbjs": "0.8.16",
    "loose-envify": "1.3.1",
    "object-assign": "4.1.1",
    "prop-types": "15.6.0"
  },
  "_requested": {
    "type": "tag",
    "registry": true,
    "raw": "formsy-react@beta",
    "name": "formsy-react",
    "escapedName": "formsy-react",
    "rawSpec": "beta",
    "saveSpec": null,
    "fetchSpec": "beta"
  },
  "_requiredBy": [
    "#USER",
    "/"
  ],
  "_resolved": "https://registry.npmjs.org/formsy-react/-/formsy-react-1.0.0.tgz",
  "_shasum": "305d4f1da8144badbe9847b1a9b509dc00a77881",
  "_spec": "formsy-react@beta",
  "_where": "/Users/Alawi/Development/Meronex/Applications/Products/residentsClub/app",
  "author": {
    "name": "Christian Alfoni"
  },
  "bugs": {
    "url": "https://github.com/christianalfoni/formsy-react/issues"
  },
  "bundleDependencies": false,
  "dependencies": {
    "form-data-to-object": "^0.2.0",
    "hoist-non-react-statics": "^2.2.1",
    "react": "^15.0.0"
  },
  "deprecated": false,
  "description": "A form input builder and validator for React JS",
  "devDependencies": {
    "babel-cli": "^6.6.5",
    "babel-loader": "^6.2.4",
    "babel-preset-es2015": "^6.6.0",
    "babel-preset-react": "^6.5.0",
    "babel-preset-stage-2": "^6.5.0",
    "create-react-class": "^15.6.0",
    "jsdom": "^6.5.1",
    "nodeunit": "^0.9.1",
    "prop-types": "^15.5.10",
    "react": "^15.0.0",
    "react-addons-pure-render-mixin": "^15.0.0",
    "react-addons-test-utils": "^15.0.0",
    "react-dom": "^15.0.0",
    "sinon": "^1.17.3",
    "webpack": "^1.12.14",
    "webpack-dev-server": "^1.14.1"
  },
  "homepage": "https://github.com/christianalfoni/formsy-react#readme",
  "keywords": [
    "react",
    "form",
    "forms",
    "validation",
    "react-component"
  ],
  "license": "MIT",
  "main": "lib/index.js",
  "name": "formsy-react",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/christianalfoni/formsy-react.git"
  },
  "scripts": {
    "build": "NODE_ENV=production webpack -p --config webpack.production.config.js",
    "examples": "webpack-dev-server --config examples/webpack.config.js --content-base examples",
    "prepublish": "babel ./src/ -d ./lib/",
    "test": "babel-node testrunner"
  },
  "version": "1.0.0"
}
twisty commented 6 years ago

@aliogaili The reason react 15 is getting installed again is that the beta published to npm has react 15 listed as a dependency. It should be a peerDependency. This was fixed on the beta branch over a month ago, but there hasn't been a new beta release pushed to npm since the fix.

"I know!", you might think. "I'll just install it straight from the github repo!". Well, this does work, but takes a bit of twiddling. You may not get the built release files (the lib folder doesn't exist in the repo, and for some reason yarn wasn't transcoding them on install, YMMV):

This installs the latest version of the beta branch, transcodes the source, then removes any devDependencies.

yarn add https://github.com/christianalfoni/formsy-react#beta
cd ./node_modules/formsy-react
yarn install
yarn install --production --ignore-scripts

I think you'll still get a warning about the react peer dependency, but it should run okay.

aogaili commented 6 years ago

If you download the tar referenced by the resolved url then you'll get a package.json that has react 15 referenced as a dependency (and not peer dependency).

Moving react from dependency to peer dependency was done by the last commit here and it has not been published to npm yet, which explains why I keep getting the older package.json with the react 15 as dependency.

So how are you folks using the last commit?

aogaili commented 6 years ago

Thank you so much @twisty ! that's what I'm looking for, it was a bit confusing for me, but now it's clear.

aogaili commented 6 years ago

@twisty I've following the steps you gave and I keep getting uncaughtException: Cannot find module 'formsy-react

Formsy-react is in the package.json and in the node_modules folders but the app doesn't start and I receive this exception :(

twisty commented 6 years ago

Hi @aliogaili, I think technically it's all installed properly, but I think those errors are because the alpha 7 of formsy-react-components doesn't support the tip of the formsy-react beta branch. (It looks like Formsy.Form has gone away).

I've got an alpha ready to go that fixes this, but would prefer to wait for a new release from this repo. I'm not keen on documenting the process of depending on this branch, which won't be fun.

I'm hesitant to call out the batsignal for @aesopwolf or another maintainer, but it would really help to get a response or an ETA on this.

aogaili commented 6 years ago

I just downloaded the version currently published on the NPM registry, patched it to remove the react dependency and installed it locally, it's working, for now.

But I really hope we can hear soon from the maintainer(s) of formsy-react and we get a newer version on NPM. This is a very useful and well designed library and really not much effort needs to get it up and running. I'm sure more people will run through this issue as they start updating to React 16, so the sooner this get resolved the better. Hopefully, the batsignal does it job :)

aogaili commented 6 years ago

@Semigradsky I see you made contributions to formsy-react, and as it stand it's currently blocking the adoption of React 16 because the last comment has not been published to NPM.

@twisty there are two forks of this library due to the inactivity here:

  1. formsy-react-2 which has been created by the @maccuaa who is also maintaining formsy-mui
  2. formsy-react-es6 forked by @track0x1 who is also maintaining formsy-react-native

I think both of those forks exist due to the lack of activity here at the moment. I'm blocked from publishing my project because I'm using formsy-react-components which is depending on this version of formsy-react and it's conflicting with React 16. Thus can you please consider aligning with one of the two libraries (or even maintaining your own fork if you wish) until we can get some traction here so we can at least move forward with React 16?

Thanks!

rkuykendall commented 6 years ago

This issue has been moved to the new formsy organization: https://github.com/formsy/formsy-react/issues/7

rkuykendall commented 6 years ago

This issue has been SOLVED in the new formsy organization with Formsy 1.1.0: https://github.com/formsy/formsy-react/