-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Can't resolve 'react-native-web/dist/exports/ViewPropTypes' after upgrading to 0.12.1 #1537
Comments
It was removed as mentioned in the release notes https://github.com/necolas/react-native-web/releases/tag/0.12.0 |
A lot of other packages are not able to be compiled after upgrading to 0.12.x |
ViewPropTypes is no longer supported on react-native-web > 0.12.0 as described on this issue necolas/react-native-web#1537
ViewPropTypes is no longer supported on react-native-web > 0.12.0 as described on this issue necolas/react-native-web#1537
ViewPropTypes is no longer supported on react-native-web > 0.12.0 as described on this issue necolas/react-native-web#1537
Hello. And errors in terminal I created the react app using System: Windows 10 What is the solution to fix this issue? |
Hello developers, Explanation Workaround
Copy & paste the code Python: fix.py OS-agnostic, use this if possible import os
import sys
print("✅ Fixing PropTypes issues")
dir_path = os.path.dirname(os.path.realpath(__file__))
rnw_filename = dir_path + "/../node_modules/react-native-web/dist/index.js"
def append_new_line(file_name, text_to_append):
"""Append given text as a new line at the end of file"""
if text_to_append in open(file_name).read():
print("⏭️ Skipping...")
else:
with open(file_name, "a+") as file_object:
file_object.write("\n")
file_object.write(text_to_append)
file_object.close()
# Fix
append_new_line(rnw_filename, "export const ViewPropTypes = { style: null };") Windows Batch: fix.bat @echo off
echo 'Fixing ViewPropTypes issues'
REM Fix ViewPropTypes issues
ECHO export const ViewPropTypes = { style: null };>>"PATH_TO_NODE_MODULES/react-native-web/dist/index.js" Unix-like bash: fix.sh #!/bin/bash
echo 'Fixing PropTypes issues'
if grep -q "export const ViewPropTypes = { style: null };" ../node_modules/react-native-web/dist/index.js; then
echo "ViewPropTypes fixed already!"
else
echo "export const ViewPropTypes = { style: null };">> ../node_modules/react-native-web/dist/index.js
fi I added in the bash a cool if-else so that you can run it infinitely without duplicating it. Please replace PATH_TO_NODE_MODULES with the path to your node_modules folder. For example, if you at your root folder it should be "node_modules"
Each time you run With the python version With .bat or .sh Hope it would help. |
Hello @franznkemaka I have the same issue of @hakuna0829 but the script didn't fix my problem, but I'm not sure if I'm making the things good, this is the way that I put that script in the package.json : .... |
Hello @willerpp, Possible fixes:
Thanks! |
Ok well, I have added it manually to the file and it works, let me try to
run the script manually.
thank you so much for your response.
…On Tue, Jun 16, 2020 at 10:38 AM Franz Nkemaka ***@***.***> wrote:
Hello @willerpp <https://github.com/willerpp>,
it should normally work. May I please see the content of your autofix.bat?
*Possible fixes:*
1.
Did you try to run the script manually via cmd? The script will only
run if something is installed. For the first time, I had to run it
manually, as I already installed my packages.
2.
Open *node_modules/react-native-web/dist/index.js*. Can you see this
at the bottom
export const ViewPropTypes = { style: null };
Thanks!
Franz
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1537 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AELWQXZHQV4UQSJVWLBQ5MLRW57YHANCNFSM4KS37KDQ>
.
|
Hello @willerpp, You're welcome and I'm happy it works for you too. Thanks! |
This is depreacted and now longer exists in react-native-web. See: necolas/react-native-web#1537
Module not found: Can't resolve 'react-native-web/dist/exports/ViewPropTypes' after update to expo sdk 39.0 |
Hello @aguilared . I had the same issue. Before, I manually copied the library I was using in my code, but it turns out was not the best way so I created a workaround. Check out my comment above: #1537 (comment) It works for me. Don't hesitate to ask me anything. |
@aguilared the same |
Did you try my workaround above, this is because ViewPropTypes was removed from react native, so react native web removed it too. |
Are you sure? I have the same issue, but npm package works without problems on RN. |
Thank you for your answer. I am sure it can help me. Could you please explain in details what this lines do? I need create a bashscript for my project. I use react-native-smooth-slider I have added
|
Hello @karpov-denys, When you add Check out my answer above #1537 (comment) I updated the answer, now there is a batch script, a bash script, and a python script. I recommend you to use the Python version since it works on both Unix-like OS & Windows having Python installed. Best regards, |
Thanks for the solution! And everyone else as well. This still isn't quite working for me. After running the script (which successfully adds the export lines to
I can make the web build compile by adding the following to However, then I get the errors that Anyone have any ideas? Would really appreciate any help. I think it's close, and I need to get this working to get my react-native-web app to compile again. |
Hi @vjsingh Did you make sure to always run your script after What solution did you use exactly? |
@franznkemaka Hey, Yeah I'm testing it before running Maybe it's because I'm running @AndreiMsk 's solution looks like it may work, but I'm not sure how to put it into a script so I can run it on |
Then make sure to export ViewPropTypes as an object that includes style property. export const ViewPropTypes = { style: null }; or export const ViewPropTypes = { style: ()=> null }; |
Yes, I used the script you provided (thanks for that!), and that exact line is at the bottom of |
Building off @AndreiMsk 's solution, I resolved this by adding the following to my
|
use patch-package first, add script at package.json
second, install patch-package
third, open
fourth, run patch-package
check created file at rootDir/patches good luck |
Hello, Thanks for this, but I don't really understand how to go about this, any help ?? |
Hi @udemezue01, to fix the problem, you have to edit the The reason why I use a script is that each time you install new packages, npm or yarn will discard your changes. So you need a script to make sure the fix is applied after. For that yarn or npm provides you a Hope it helps |
Thanks, I fixed it already
…On Tue, Oct 12, 2021 at 12:57 PM Franz Nkemaka ***@***.***> wrote:
Hello, Thanks for this, but I don't really understand how to go about
this, any help ??
Hi @udemezue01 <https://github.com/udemezue01>,
to fix the problem, you have to edit the
node_modules/react-native-web/dist/index.js file and export ViewPropTypes
so that it won't show you the error anymore.
The reason why I use a script is that each time you install new packages,
npm or yarn will discard your changes. So you need a script to make sure
the fix is applied after. For that yarn or npm provides you a postinstall
command inside your package.json scripts sections. You call call the
script from there
Hope it helps
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1537 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AD2KU4K3PMLECZTNPRFKCCDUGQPBZANCNFSM4KS37KDQ>
.
--
<https://about.me/thejohnbenjamin?promo=email_sig&utm_source=product&utm_medium=email_sig&utm_campaign=gmail_api&utm_content=thumb>
Nwabufor John
Web Developer, Blogger, Digital Marketing Expert and Serial Entrepreneur.
Visit the Link Below.
*Tchelete.com <http://Tchelete.com> (Blog)*
Make sure to also visit the links below. 🖐🏼
👉👉 How To Start a Blog. <http://Tchelete.com/how-to-start-a-blog>
|
This is depreacted and now longer exists in react-native-web. See: necolas/react-native-web#1537
thx man, it worked! |
When I add the export const ViewPropTypes = { style: ()=> null };, or export const ViewPropTypes = { style: null };, |
I have created the python script from @franznkemaka and am able to manually run it and see the expected output in react-native-web/dist/index.js but its not working when its called in the postinstall phase after running a yarn add command. My "postinstall" looks like this: I see the following error after yarn add [package] If i change my post install to use the path to python3 then its working properly: Does anyone know how I fix this so i can just call python rather than /usr/bin/python3? |
It's not related to this package at all |
It simply states that /usr/nin/python3 does not exist in your computer. Run Honestly I recommend using patch-package instead of a custom Python script |
ViewPropTypes is no longer supported on react-native-web > 0.12.0 as described on this issue necolas/react-native-web#1537
ViewPropTypes is no longer supported on react-native-web > 0.12.0 as described on this issue necolas/react-native-web#1537
ViewPropTypes is no longer supported on react-native-web > 0.12.0 as described on this issue necolas/react-native-web#1537
ViewPropTypes is no longer supported on react-native-web > 0.12.0 as described on this issue necolas/react-native-web#1537
ViewPropTypes is no longer supported on react-native-web > 0.12.0 as described on this issue necolas/react-native-web#1537
I have tried to upgrade from
react-native-web
v0.11.7 to 0.12.1 and it breaks my app:See:
https://github.com/jemise111/react-native-swipe-list-view/blob/6f22515c1d404d51bf8a6d1591ec51d241b77b9b/components/SwipeRow.js#L11
Related to:
The text was updated successfully, but these errors were encountered: