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

Please tighten StyledProps to catch invalid (but CSS-valid) values that crash Android #5650

Open
AlanSl opened this issue Jan 25, 2023 · 2 comments

Comments

@AlanSl
Copy link

AlanSl commented Jan 25, 2023

Description

StyledProps currently does a look up on React Native style types and csstype, to pull in types from the project's used versions of those dependencies. This seems to work well for most style props.

However, there are some, like alignItems, alignSelf, display etc that exist on both React Native style types and CSSTypes, and which have very permissive types like string on csstype which allows invalid values. There's an issue on their repo for that frenic/csstype#8 - to summarise: it's to allow space-separated multi value strings, which are seldom used, but are technically valid in CSS.

The net result is, some style props like alignItems end up accepting any string:

image

...but the actual app will crash on Android if the value is not one of the known allowed values listed in the React Native style type:

image

Problem Statement

If a prop will cause a hard crash in Android, NativeBase's types should flag it as invalid.

Proposed Solution or API

I think this could be solved by switching the order on the type selector to choose React Native first then CSSTypes if both have the given key? Currently, if a key exists in both, the csstype type is used and the RN type is ignored.

Alternatives

No response

Additional Information

No response

@AlanSl
Copy link
Author

AlanSl commented Jan 25, 2023

Not sure if this should be a bug report or a feature request; looks like there's a related bug report already: #5622

@seyaobey-dev
Copy link

We just faced this very situation this week: our app started crashing on android (production build). We spent a few days to understand what was the problem. Turned out , it was a misspelled string property value. This is probably a bug because I've got a previous project (on bitbucket, not on github but I can share the link if necessary) where the types are correct and intellisense is working as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants