binggg / mrn

Material React Native (MRN) - A Material Design style React Native component library.
http://mrn.js.org
1.73k stars 109 forks source link

Using removed Babel 5 option #27

Open tanmynguyen opened 8 years ago

tanmynguyen commented 8 years ago

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

martinezguillaume commented 8 years ago

same here

uknownothingsnow commented 8 years ago

+1

rafaelcorreiapoli commented 8 years ago

+1

nevaryyy commented 7 years ago

+1

joncursi commented 7 years ago

+1 on this TransformError:

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

nevaryyy commented 7 years ago

(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 commented 7 years ago

It is still this issue !