sramezani / radio-buttons-react-native

Animated radio buttons component for react native
MIT License
84 stars 41 forks source link

Question for compile failure of example code #2

Open tk-dev0927 opened 4 years ago

tk-dev0927 commented 4 years ago

Hi,

I got an error, "Failed to compile" when I run the example code. I am new to React Native and the error location is not in the example code. So I wonder if this is module problem.

Failed to compile C:/ReactNative/TestApp/node_modules/radio-buttons-react-native/RadioButtonRN.js 101:20 Module parse failed: Unexpected token (101:20) You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders }
fadeInAnimation = () => {

| // this.fadeAnim.setValue(0) | Animated.timing(this.state.fadeAnim, { This error occurred during the build time and cannot be dismissed.

afamgit commented 4 years ago

Same problem. Any solution to this problem yet?

ceessay commented 4 years ago

Found a fix that works on my expo project. Just create a webpack.config.js file with the following content:

const createExpoWebpackConfigAsync = require("@expo/webpack-config");

module.exports = async function (env, argv) {
  const config = await createExpoWebpackConfigAsync(
    {
      ...env,
      babel: {
        dangerouslyAddModulePathsToTranspile: [
          // Ensure that all packages starting with @evanbacon are transpiled.
          "RadioButtonRN",
        ],
      },
    },
    argv
  );
  return config;
};

Answer from this links https://github.com/expo/expo-cli/tree/master/packages/webpack-config#include-modules

Vibinreji commented 3 years ago

Any solution?

daraujo-etg commented 2 years ago

@ceessay I was having the same problem and this worked for me. Thanks!