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
fix(ios): allow TableViewRow proxy to return correct view #12225
Conversation
@@ -528,7 +528,7 @@ - (TiProxy *)parentForBubbling | |||
|
|||
- (UIView *)view | |||
{ | |||
return nil; | |||
return rowContainerView; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garymathews TiUITableViewRowContainer is subclass of UIView. Ideally it should be subclass of TiUIView. It may crash at some point because all functions and properties available in TiUIView is not available with TiUITableViewRowContainer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should view
enforce TiUIView
?
- (TiUIView *)view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the PR, TiUITableViewRowContainer
is now a subclass of TiUIView
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garymathews I am not sure if it will work. I guess it may cause layout issues. 1. Can you test long tableview (at least some tableview rows goes out of screen) with different contents (to verify reusability of cells).
2. Need to test a bit more around TableViewRow properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From my testing, everything works as it should with no layout or event issues. I don't think using TiUIView
is necessary, but there's no harm in maintaining the change.
All of the tests are passing, including the problematic tests for TIMOB-28148 and TIMOB-27935.
TEST CASE
NOTE: I ran through more tests than this, but this provides a nice base to test more properties and complex views.
const win = Ti.UI.createWindow();
const tableData = [];
for (let i = 1; i <= 100; i++) {
const row = Ti.UI.createTableViewRow();
const label = Ti.UI.createLabel({
color: 'black',
text: `Row #${i}`,
height: 50
});
row.add(label);
tableData.push(row);
}
const tableView = Ti.UI.createTableView({ data: tableData });
tableView.addEventListener('click', e => {
const row = tableData[e.index];
const message = `Clicked row ${e.index + 1}\n\nrect.width: ${row.rect.width}\nrect.height: ${row.rect.height}`;
// NOTE: `borderRadius` on TableViewRow has no effect on iOS.
row.borderRadius = 20;
row.backgroundColor = 'red';
Ti.API.info(message);
alert(message);
});
tableView.addEventListener('longpress', e => {
const message = `Long-pressed row ${e.index + 1}`;
Ti.API.info(message);
alert(message);
});
const restartButton = Ti.UI.createButton({
title: 'Restart',
bottom: 5,
right: 5
});
restartButton.addEventListener('click', _ => {
Ti.App._restart();
});
win.add([ tableView, restartButton ]);
win.open();
We can notify QE to run through more TableView tests.
Tests:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes looks good.
@qe Can you verify other layout properties and memory release.
FR Passed. Verified on: |
TableViewRowProxy
to return correct view forrect
calculationrow#rect
inti.ui.tableview.test.js
UIView
to prevent TIMOB-28148TIMOB-28148 : adding view on row causing crash
inti.ui.tableview.test.js
TEST CASE
JIRA Ticket