Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Rewrite for RN 0.50+ #151

Merged
merged 20 commits into from
Jan 16, 2018
Merged

Rewrite for RN 0.50+ #151

merged 20 commits into from
Jan 16, 2018

Conversation

jasonfma
Copy link
Collaborator

@jasonfma jasonfma commented Nov 5, 2017

Major upgrade that supports 0.50+

  • support by adding reactNativeVersion and DeviceInfo properties to the NativeModules
  • Remove Navigator test as it was removed from RN
  • Fix BackAndroid and add BackHandler tests
  • update all packages
  • fix lint issues
  • drop support for Node 4

NOTE: This is a PR into the existing rewrite branch

@jasonfma jasonfma changed the title Rewrite Rewrite for RN 0.49+ Nov 5, 2017
Jason Ma added 11 commits November 5, 2017 13:09
- update enzyme and use enzyme's react 16 adapter
- add RN and react devDeps for now (reflects the peerDeps)
- Add newly required `reactNativeVersion` and `DeviceInfo` properties to the `NativeModules`
  - `reactNativeVersion` reads from the RN source
  - `DeviceInfo` is set to iPhone 6
- BackAndroid is deprecated by BackHandler
- added test for BackHandler
- Remove obsolete test of `addEventListener().remove()`
- backwards compatible changes for RN 0.50
- RN 0.50 adds attributes to components and breaks the buildComponentHTML approach to testing
- TODO lint fixes
- remove unnecessary assertion because it's asserted implicitly in the next assertion
Jason Ma added 3 commits November 5, 2017 13:19
Signed-off-by: Jason Ma <jason@peartherapeutics.com>
- render of `ProgressBarAndroid` changed from `ActivityIndicator` in RN 0.49 back to  `AndroidProgressBar` in RN 0.50

Signed-off-by: Jason Ma <jason@peartherapeutics.com>
@jasonfma jasonfma changed the title Rewrite for RN 0.49+ Rewrite for RN 0.50+ Nov 6, 2017
@jasonfma
Copy link
Collaborator Author

jasonfma commented Nov 6, 2017

Changing to support RN 0.50+ because the AndroidProgressBar had a breaking change in RN 0.49 that was fixed in RN 0.50. Rather than start off backwards compatible with 0.49, just do 0.50+.

Jason Ma added 4 commits November 5, 2017 19:03
Signed-off-by: Jason Ma <jason@peartherapeutics.com>
Signed-off-by: Jason Ma <jason@peartherapeutics.com>
Signed-off-by: Jason Ma <jason@peartherapeutics.com>
Signed-off-by: Jason Ma <jason@peartherapeutics.com>
@jasonfma
Copy link
Collaborator Author

jasonfma commented Nov 6, 2017

@dusave
Copy link

dusave commented Nov 9, 2017

Should probably add react, react-dom, and react-native as dev dependencies also. When trying to build locally without those packages, it fails

@RealOrangeOne
Copy link
Owner

Initial skim looks good. Would probably be ideal to update the README stating that we've dropped support for Node <6 (and why?). Will give it a proper review soon, but glad to see the tests are passing!

@gabceb
Copy link

gabceb commented Nov 10, 2017

Looking forward to this @RealOrangeOne and @jasonfma. When I try to pull this branch as a dev dependency for my project running RN 0.50 and React 16 it complains when running haste.js as part of the post install

Error: EISDIR: illegal operation on a directory, read
    at Error (native)
    at Object.fs.readSync (fs.js:731:19)
    at tryReadSync (fs.js:486:20)
    at Object.fs.readFileSync (fs.js:534:19)
    at /Users/gabrielcebrian/Projects/tes/mobile/app-job-mobile/node_modules/react-native-mock/src/haste.js:32:39
    at Function._.each._.forEach (/Users/gabrielcebrian/Projects/tes/mobile/app-job-mobile/node_modules/underscore/underscore.js:153:9)
    at Object.<anonymous> (/Users/gabrielcebrian/Projects/tes/mobile/app-job-mobile/node_modules/react-native-mock/src/haste.js:31:3)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)

If I clone the project on a different folder the post-install finishes as expected

@EdenGottlieb
Copy link

Adding a mock for FlatList would be a great idea, in my opinion.

Copy link
Owner

@RealOrangeOne RealOrangeOne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks pretty good, a couple small comments. Amazing work! 🎉

.travis.yml Outdated
- "6"
- "8"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we keep the base versions here too, so add 8.0.0

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use 8.9.1 as that is the LTS version?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using 8 specifically targets the latest release at build time, which is fine. I quite like the idea of testing against the base version as well

@@ -14,7 +14,7 @@ import { expect } from 'chai';
describe('Easing', () => {
const { Easing } = require('react-native');

it('should have all functions', function () {
it('should have all functions', () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert changes like this back. function is correct here

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrow functions should be just fine. You're using them above on line 14 already. Is there something I'm missing?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, this change was part of the eslint rule update. I just wholesale applied the rule fixes. I can revert, but do you have more context as to why this one needs to be function?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed all were using function, in that case this is totally fine

@jasonfma
Copy link
Collaborator Author

jasonfma commented Dec 5, 2017

@RealOrangeOne just to be clear, this is a PR into the rewrite branch that you created. This is not a merge into master.

- Update readme to reference Node 6 support
- Update travis to include Node 8.0.0 tests
@jasonfma
Copy link
Collaborator Author

jasonfma commented Jan 6, 2018

@RealOrangeOne Looks like node 8.0.0 is broken. I'm going to set to 8.9.1 since it's the first LTS version.

@RealOrangeOne
Copy link
Owner

Just seen the build log, agreed that's very weird. I think sticking to that version will probably be fine, it's early enough!

@jasonfma
Copy link
Collaborator Author

jasonfma commented Jan 7, 2018

@RealOrangeOne can you rebuild? I think it failed because of https://github.com/npm/registry/issues/255

@jasonfma
Copy link
Collaborator Author

jasonfma commented Jan 7, 2018

dustinsavery commented on Nov 9, 2017
Should probably add react, react-dom, and react-native as dev dependencies also. When trying to build locally without those packages, it fails

I think this is set up this way so the build can test with various versions of each. I did add them as peerDeps so you can see the warnings.

@RealOrangeOne comments addressed

@jasonfma
Copy link
Collaborator Author

jasonfma commented Jan 16, 2018

@RealOrangeOne will you have some time soon to take a look? I'm happy to help here where I can too. This PR is to merge into your existing rewrite branch #120 where there are still some merge conflicts to resolve as well - so this is not final or going into master.

@RealOrangeOne
Copy link
Owner

All these changes look good to me! Let's get this into rewrite and see how it affects it!

@RealOrangeOne RealOrangeOne merged commit 5df69b0 into RealOrangeOne:rewrite Jan 16, 2018
@lalop
Copy link

lalop commented Feb 5, 2018

I tried rewrite branch but I get this error

Cannot find module './build/react-native-mock.js' from 'mock.js'

Will we use this branch as master ?

@RealOrangeOne
Copy link
Owner

If you're downloading straight from GitHub, you'll have to build the compiled code to actually use it.

Yes, this code will eventually be pushed into master. Time frame unknown, but shouldn't be too long!

@lalop
Copy link

lalop commented Feb 5, 2018

I get it via yarn, but build folder isn't present.
Is that normal ?

@RealOrangeOne
Copy link
Owner

Yarn, npm, makes no difference. We don't commit the build/ directory for obviousl reasons, committing build artifacts is bad practice. If you want to use a version from somewhere other than npm, you'll need to run the build yourself from the project directory, else you'll only have the source files, which won't work.

@lalop
Copy link

lalop commented Feb 5, 2018

I'm agree with you but I'm not sure to understand.
I get react-native-mock via yarn, that provide source code not built but https://github.com/RealOrangeOne/react-native-mock/blob/rewrite/mock.js call ./build/react-native-mock.js so is there something wrong here or should I build the package even if I get it via npm/yarn ?

@RealOrangeOne
Copy link
Owner

RealOrangeOne commented Feb 5, 2018

hmm, this sounds odd, and probably not the best place to discuss. Perhaps raise an actual issue so it can be looked into properly

@lalop
Copy link

lalop commented Feb 5, 2018

done #157

This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants