Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using removed Babel 5 option #27

Open
tanmynguyen opened this issue May 6, 2016 · 7 comments
Open

Using removed Babel 5 option #27

tanmynguyen opened this issue May 6, 2016 · 7 comments

Comments

@tanmynguyen
Copy link

Hi team!
When i apply mrn in my project react-native (v0.25), then I build....
untitled
Help me, please!!
Thanks!!!

@martinezguillaume
Copy link

same here

@uknownothingsnow
Copy link

+1

2 similar comments
@rafaelcorreiapoli
Copy link

+1

@nevaryyy
Copy link

+1

@joncursi
Copy link

+1 on this TransformError:

screen shot 2016-07-14 at 5 36 54 pm

@nevaryyy
Copy link

nevaryyy commented Jul 15, 2016

(Sorry, I'm not good at English)
I've solved this problem.

I think the reason is:
Note: If your react-native version is 0.16+, For now can't support mrn
My RN version is 0.28, so this problem occurred.

The solution is:

  1. modify the file \node_modules\mrn.babelrc, delete "whitelist" and its value, add
"plugins": [
    "transform-regenerator",
    "syntax-flow"
    ],
  "presets": [
        "react", "es2015"
  ],

to this file. Finally like this;

.babelrc

{
  "retainLines": true,
  "compact": true,
  "comments": false,
  "sourceMaps": false,
  "plugins": [
    "transform-regenerator",
    "syntax-flow"
    ],
  "presets": [
        "react", "es2015"
  ],
}

  1. Modify all the JS file in directory \node_modules\mrn\lib, except config, Icon and Index.

Before:

import React, {
    Component,
    StyleSheet,
    PropTypes,
    View,
    Image
} from 'react-native';

After:

import React, {
    PropTypes,
    Component
} from 'react';
import {
    StyleSheet,
    View,
    Image
} from 'react-native';

In other words, import React and {PropTypes, Component} from 'react', import others from 'react-native'.

Not finished. Delete "export default" before "class ViewName(e.g. Avatar)“. And add "module.exports = ViewName(e.g. Avatar);" to the end of the file.

The core of step 1 is babel, it changed a lot from babel 5 to babel6.
The core of step 2 is RN, if you have a high version RN, some features or syntax changed, so it can not support mrn.

Well, finally I run the project on device successful. But I think my solution is not good, hope someone provide a better one.

@RichardSleet
Copy link

It is still this issue !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants