Parse-SDK-JS: Latest react-native (0.32.0) breaks Parse JS

Issue Description

Parse import doesn’t work with react-native 0.32.0, well working on 0.31.0

0.31.0

capture d ecran 2016-08-30 a 23 53 05 #### 0.32.0 capture d ecran 2016-08-30 a 23 57 23

Steps to Reproduce / Code Snippets

var Parse = require(parse/react-native)

Expected Results

The same behavior on 0.31 and 0.32

Additional Information

  • React Native version: 0.32.0
  • Platform(s) (iOS, Android, or both?): iOS probably both
  • Operating System (macOS, Linux, or Windows?): macOS

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 20
  • Comments: 17 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Ran into this issue as well. I was able to patch it by changing the following line in node_modules/parse/lib/react-native/StorageController.react-native.js

var _reactNative = require('react-native');

to

var _reactNative = require('../../../react-native');

Basically just pointed it to the react-native in my node_modules folder instead of letting require() figure it out. Very dirty fix, but it’s working for me now with RN 0.32.0 and RN 0.33.0-rc.0. Not really sure what is happening. I plan on digging into it later tonight when I have more time. If I find something I’ll submit a PR if a fix doesn’t land before.

I’ll do my best to understand what’s happening here, and try to come up with a fix

Should be fixed. I’m able to start up a new RN project from scratch with v0.34

It seems that in 0.43, react-native/Libraries/react-native/react-native.js was renamed to react-native/Libraries/react-native/react-native-implementation.js

So in node_modules/parse/lib/react-native/StorageController.react-native.js change the import line to: import { AsyncStorage } from 'react-native/Libraries/react-native/react-native-implementation.js'

Recently, RN changed their Babel transforms to manually rewrite require('react-native') to the relative path of the library. I believe this is the cause of the issue, and I’ve been trying to find the amount of Babel processing needed on the Parse side to make things work smoothly with the processor on the RN side. Should have something working by the end of the day, if all goes well.

Doesn’t work in RN 0.43 for me either