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

Runing on web browser #50

Open
Nutricontrol opened this issue Feb 16, 2021 · 1 comment
Open

Runing on web browser #50

Nutricontrol opened this issue Feb 16, 2021 · 1 comment

Comments

@Nutricontrol
Copy link

Nutricontrol commented Feb 16, 2021

When I try to use the library in a web browser it gives me the following error:

TypeError: Cannot read property 'style' of undefined
Module .../node_modules/react-native-responsive-layout/src/components/grid/index.js
C:/.../node_modules/react-native-responsive-layout/src/components/grid/index.js:216

213 | horizontal: PropTypes.bool,
214 | scrollable: PropTypes.bool,
215 | relativeTo: PropTypes.oneOf(['parent', 'self', 'window']),
216 | style: ViewPropTypes.style,
217 | stretchable: PropTypes.bool,
218 |
219 | children: PropTypes.oneOfType([

It would be great to be able to use this library to reuse the code between mobile devices, tablets and web browser. I try to put a style attribute on the view tag of my component, but the error persist. Is there any way to fix the error?

Thanks!

@Nutricontrol
Copy link
Author

I found the same issue in a different repo and they solved it replacing:

ViewPropTypes.style
with:
PropTypes.any

I tested this change locally and it seems to work with this repo too.
I had to do this change in grid/index.js, and section/index.js.
Those files are already importing PropTypes and using it, so looks like a suitable solution.

mohghaderi added a commit to mohghaderi/react-native-responsive-layout that referenced this issue Feb 24, 2021
mohghaderi added a commit to mohghaderi/react-native-responsive-layout that referenced this issue Feb 24, 2021
mohghaderi added a commit to mohghaderi/react-native-responsive-layout that referenced this issue Mar 2, 2021
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

1 participant