cawfree / react-native-rotary

🕰️ A <Rotary /> component for React Native.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hello

StefaniaJ opened this issue · comments

Hi, I followed the steps to install it and I have a problem. It says:
./node_modules/react-native-rotary/index.js
SyntaxError: C:\Users\lenovo\Desktop\exam2019\node_modules\react-native-rotary\index.js: Unexpected token (93:12)

91 | );
92 | return (

93 | <Animated.View
| ^
94 | key={index}
95 | style={{
96 | opacity: scale,

Do I have to install something else?
Thank you!

yes

Okay, that's no problem. You just need to tell Webpack that you want to compile react-native-rotary with Babel by updating the include path for the Babel plugin (as you start to use other dependencies, you'll find this is a pretty common step):

project-dir/config/webpack.config.dev.js
Look for the line with says "Process the application JS with Babel."

// Process application JS with Babel.
// The preset includes JSX, Flow, and some ESnext features.
{
 test: /\.(js|mjs|jsx|ts|tsx)$/,
 // change your include from include: paths.appSrc to the array below:
 include: [
    paths.appSrc,
    path.resolve(paths.appNodeModules, "react-native-rotary"),
 ],
 { ...extraConfig }
}

I'm sorry, I'm using react native app. is it a different?

That's okay. What device are you running this on?

Laptop

Okay, so when you run your app you want to see it load in a Web Browser? Just to check, how do you start your app? Are you doing something like:

npm run android # or yarn android
npm run web # or yarn web
npm run ios # or yarn ios

Yes, this is what I want and I'm using npm start

Okay, so provided you have made these changes, stop the metro bundler (which you've ran using npm start) and then use npm run web to restart the bundler, this plugin should work as expected on localhost:3000. :)