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

Fails to run on react-native-web #24

Open
bader-ht opened this issue May 17, 2020 · 5 comments
Open

Fails to run on react-native-web #24

bader-ht opened this issue May 17, 2020 · 5 comments

Comments

@bader-ht
Copy link

bader-ht commented May 17, 2020

Hi guys. I'm having trouble with this package. It was installed as a dependency of react-native-gifted-chat.

./node_modules/react-native-typing-animation/src/index.js
SyntaxError: /Users/bader/Work/projects/react/gifted-chat-web-demo/node_modules/react-native-typing-animation/src/index.js: Unexpected token (37:6)

  35 | 
  36 |     return (
> 37 |       <View style={[styles.container, style]}>
     |       ^
  38 |         <Dot x={dotX - dotRadius - dotMargin} y={this.state.y1} radius={dotRadius} style={dotStyles} dotColor={dotColor} />
  39 |         <Dot x={dotX} y={this.state.y2} radius={dotRadius} style={dotStyles} dotColor={dotColor} />
  40 |         <Dot x={dotX + dotRadius + dotMargin} y={this.state.y3} radius={dotRadius} style={dotStyles} dotColor={dotColor} />

I'm running through react-native-rewired, which as per gifted chat's documentation, we have the following config-override.js, which changes our build as follows:

module.exports = function override(config, env) {
  config.module.rules.push({
    test: /\.js$/,
    exclude: /node_modules[/\\](?!react-native-gifted-chat|react-native-lightbox|react-native-parsed-text|expo-av)/,
    use: {
      loader: 'babel-loader',
      options: {
        babelrc: false,
        configFile: false,
        presets: [
          ['@babel/preset-env', { useBuiltIns: 'usage' }],
          '@babel/preset-react',
        ],
        plugins: ['@babel/plugin-proposal-class-properties'],
      },
    },
  })

  return config
}

Any ideas as to whats going wrong? I noticed in the Readme that this specifically supports react-native-web, but this is crashing.

@ghost
Copy link

ghost commented May 26, 2020

Hi @bader-ht, kindly share your code for the Gifted Chat component on your project.

@xcarpentier
Copy link
Collaborator

xcarpentier commented Jun 26, 2020

Hi @bader-ht,
did you try to add react-native-typing-animation into exclude glob in webpack config?

@bader-ht
Copy link
Author

bader-ht commented Jun 26, 2020 via email

@bader-ht
Copy link
Author

bader-ht commented Jul 2, 2020

Thank you @xcarpentier, that got the project to compile, but typing animation does not actually show. Does Animated.View work on react-native-web?

@xcarpentier
Copy link
Collaborator

Yes it should: #18 (comment)

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