dohooo / react-native-table-component

🌱Build table for react native
MIT License
730 stars 188 forks source link

ViewPropTypes' is not supported in 'react-native-web' v12.0 onwards #131

Closed markybry closed 2 years ago

markybry commented 3 years ago

If you upgrade to RNW 12.0 or greater you can no longer use react native web

Error: ./node_modules/react-native-table-component/components/rows.js Cannot find module: 'react-native-web/dist/exports/ViewPropTypes'. Make sure this package is installed.

Dammic commented 3 years ago

As I think this might not get fixed quickly, in the meantime I've prepared my own, slightly hacky workaround: In ./scripts/fix-rn-web-proptypes-issue.sh:

#!/bin/bash

echo 'Fixing PropTypes issue related to react-native-table-component...'
for file in ./node_modules/react-native-table-component/components/*.js; do
    sed -i '/ViewPropTypes\.style/g' $file
    sed -i '/Text\.propTypes/g' $file
done
echo 'PropTypes issue fixed!'

And then in package.json:

scripts: {
    "postinstall": "sh ./scripts/fix-rn-web-proptypes-issue.sh"
}

The problem is just with propTypes, the rest appears to bo working fine.

andyasberry commented 2 years ago

Implemented fixes from #138 in a forked repo and published as a new npm package. See this comment for more details: https://github.com/Gil2015/react-native-table-component/issues/141#issuecomment-947124370

Don't plan on maintaining/supporting it, but hopefully it will help anyone who is trying to get over this hump.