Giter Club home page Giter Club logo

Comments (3)

txs avatar txs commented on August 20, 2024

You might use the latest react, so you have to import PropTypes as a standalone package

from react-web-gifted-chat.

c-goettert avatar c-goettert commented on August 20, 2024

I had the same issue. It's react-native-parsed-text causing this issues because it's using the Object-spread syntax as shown in the error (...ReactNative.Text.propTypes), which is obviously not compiled by babel in your Project. You need to configure webpack so it compiles the module. If you created your App using create-react-app, there is no way to configure webpack directly. You either have to eject the project, or use react-app-rewired to do so.
Then, in webpack-config you need to add the module path of react-native-parsed-text to the babel-loader 'includes'-property. Something like this:

// webpack-config:
...
{
  test: /\.(js|jsx|mjs)$/,
  include: [
    paths.appSrc,
    'YOUR-PROJECT-PATH/node_modules/react-native-parsed-text'
  ],
  loader: require.resolve('babel-loader')
},
...

If your using react-app-rewired, your config-overrides.js might look something like this (didn't test):

const { getBabelLoader } = require('react-app-rewired')
const fs = require('fs')
const path = require('path')

const appDirectory = fs.realpathSync(process.cwd())
const resolveApp = relativePath => path.resolve(appDirectory, relativePath)

/* config-overrides.js */
module.exports = function override (config, env) {
  const babelLoader = getBabelLoader(config.module.rules)
  babelLoader.include = [resolveApp('src'), resolveApp('node_modules/react-native-parsed-text')]
  return config
}

Note: Unfortunately, after this step I got to issue#1.

from react-web-gifted-chat.

johniak avatar johniak commented on August 20, 2024

Yeah, it was broken, in the next upgrade it will be working, I also fixed example, this is already on repository, but it's not pushed to npm, it also contains new react version

from react-web-gifted-chat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.