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

chore(android): TableViewRow/ListItem added after theme switch should use current theme #12622

Merged
merged 4 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -141,8 +141,15 @@ public void bind(final ListItemProxy proxy, final boolean selected)
}

if (proxy != null) {
final TiUIView view = proxy.getOrCreateView();
// Update list item proxy's activity in case it has changed, such as after a dark/light theme change.
final Context context = this.itemView.getContext();
if ((context instanceof Activity) && (proxy.getActivity() != context)) {
proxy.releaseViews();
proxy.setActivity((Activity) context);
}

// Get or create the view. (Must be called after updating activity above.)
final TiUIView view = proxy.getOrCreateView();
if (view != null) {
final ViewGroup borderView = (ViewGroup) view.getOuterView();
final ViewGroup nativeView = (ViewGroup) view.getNativeView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ public void bind(final TableViewRowProxy proxy, final boolean selected)
// Obtain proxy properties.
final KrollDict properties = proxy.getProperties();

// Update row proxy's activity in case it has changed, such as after a dark/light theme change.
final Context context = this.itemView.getContext();
if ((context instanceof Activity) && (proxy.getActivity() != context)) {
proxy.releaseViews();
proxy.setActivity((Activity) context);
}

// Obtain row view.
final TableViewRowProxy.RowView rowView = (TableViewRowProxy.RowView) proxy.getOrCreateView();
if (rowView != null) {
Expand Down