Parse-sdk-js: Latest react-native (0.32.0) breaks Parse JS

Created on 31 Aug 2016  路  17Comments  路  Source: parse-community/Parse-SDK-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

Most helpful comment

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.

All 17 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'm thinking about dozens of npm package working like Parse impacted by that littles changes on React-Native

Seeing the same issue here. Did anyone manage to track down the source of it? Looks pretty disturbing

Any updates on this? I have been trying to hunt down the source of this issue but without much luck - I did however notice that RN's packager does not seem to have a module id for "react-native" when called through their patched require function, instead it passes the string literal "react-native" (and not a module id integer)

@jarredwitt @didierfranc any ideas on how to get Parse team at least remotely interested in looking into this? I tried tweeting at them with no result - https://twitter.com/callmephilip/status/778666813278347300

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

is anyone resolved this issues?

Can confirm it's still with RN 0.34

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.

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

What a change! Thank you very much. I can confirm its working with RN v0.34

thank you @andrewimm

Hey guys, I'm curious how you got this to work?

Indeed, I no longer get errors for the library, however queries don't seem to work. I receive "Can't authenticate to your Mongo database" when attempting to find() query results. How do you guys do it?

Doesn't work in RN 0.43 for me either

Still broken for 0.43

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'

Was this page helpful?
0 / 5 - 0 ratings

Related issues

guilhermevini picture guilhermevini  路  6Comments

dblythy picture dblythy  路  4Comments

jlnquere picture jlnquere  路  4Comments

dplewis picture dplewis  路  7Comments

RaschidJFR picture RaschidJFR  路  7Comments