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

TIMOB-14566 add null value checking #4459

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ public void propertyChanged(String key, Object oldValue, Object newValue, KrollP
} else if (key.equals(TiC.PROPERTY_TOUCH_ENABLED)) {
doSetClickable(TiConvert.toBoolean(newValue));
} else if (key.equals(TiC.PROPERTY_VISIBLE)) {
newValue = (newValue == null) ? false : newValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to add this check in TiUIView.processProperties() as well b/c user can set "visible: null" during creation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modified

this.setVisibility(TiConvert.toBoolean(newValue) ? View.VISIBLE : View.INVISIBLE);
} else if (key.equals(TiC.PROPERTY_ENABLED)) {
nativeView.setEnabled(TiConvert.toBoolean(newValue));
Expand Down Expand Up @@ -730,7 +731,12 @@ public void processProperties(KrollDict d)
}

if (d.containsKey(TiC.PROPERTY_VISIBLE) && !nativeViewNull) {
setVisibility(TiConvert.toBoolean(d, TiC.PROPERTY_VISIBLE, true) ? View.VISIBLE : View.INVISIBLE);
Object visible = d.get(TiC.PROPERTY_VISIBLE);
if (visible != null) {
setVisibility(TiConvert.toBoolean(visible, true) ? View.VISIBLE : View.INVISIBLE);
} else {
setVisibility(View.INVISIBLE);
}
}
if (d.containsKey(TiC.PROPERTY_ENABLED) && !nativeViewNull) {
nativeView.setEnabled(TiConvert.toBoolean(d, TiC.PROPERTY_ENABLED, true));
Expand Down