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

Not working with create-react-native-app #131

Open
laukaichung opened this issue May 17, 2017 · 4 comments
Open

Not working with create-react-native-app #131

laukaichung opened this issue May 17, 2017 · 4 comments

Comments

@laukaichung
Copy link

laukaichung commented May 17, 2017

I have started a new project with create-react-native-app.
Change the .babelrc to this:

 {
  "presets": ["babel-preset-expo"],
  "env": {
    "development": {
      "plugins": [
        "transform-react-jsx-source",
      ]
    }
  },
  "plugins": [
    ["import", { "libraryName": "antd-mobile" }]
  ]
}
import { Button } from 'antd-mobile';

export class Screen extends React.Component<any,{}>{
   render(){
     return(
            <View>
                <Button>Something</Button>
            </View>
        )
   }
}

I'm still getting this error:

Note: must use https://github.com/ant-design/babel-plugin-import .
For more information, please see https://github.com/ant-design/ant-design-mobile/issues/602
@r20
Copy link

r20 commented May 17, 2017

I have the same problem but with create-react-app and antd (not mobile).

@laukaichung
Copy link
Author

@r20 , I wonder if it's because create-react-app ignores the changes in .babelrc. I'm still waiting for some sort of alternative to changing the .babelrc file.

@r20
Copy link

r20 commented May 18, 2017

@stonecold123 , I haven't tried it yet but see http://stackoverflow.com/questions/44034773/how-do-i-use-babelrc-to-get-babel-plugin-import-working-for-antd.
I haven't run eject, so this is something I'll try.

@laukaichung
Copy link
Author

@r20, someone on the CRNA forum says you shouldn't need to eject to use the framework with different babel settings. I think there's a problem with the plugin itself. The antd team also says they are going to make an expo example ant-design/ant-design-mobile#1333 , so I'd wait before resort to eject.

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

2 participants