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

fix(ios): expose "sectionHeaderTopPadding" for layout backwards compatibility #13021

Merged
merged 2 commits into from Aug 20, 2021

Conversation

hansemannn
Copy link
Collaborator

@hansemannn hansemannn commented Aug 14, 2021

JIRA:
https://jira.appcelerator.org/browse/TIMOB-28524

Summary:

  • Adds property "sectionHeaderTopPadding" to ListView and TableView. Only supported on iOS 15+.
  • Note that iOS 15 displays more padding above every header compared to older iOS versions.
  • Setting this property to zero restored old behavior. (ie: No extra padding).

ListView Test:

  1. Build and run the below on iOS 15.
  2. Note the padding above the 2 section. (Looks like "issue.png" attached to TIMOB-28524.)
  3. Uncomment the sectionHeaderTopPadding: 0.0 line below and re-run.
  4. Notice the extra section padding is gone. (Looks like "fix.png" attached to TIMOB-28524.)
const window = Ti.UI.createWindow({ title: 'Window 1', backgroundColor: '#f0f0f0' });
window.add(Ti.UI.createListView({
//	sectionHeaderTopPadding: 0.0,
	sections: [
		Ti.UI.createListSection({
			headerView: Ti.UI.createView({ height: 10 }),
			footerView: Ti.UI.createView({ height: 10 }),
			items: [
				{ properties: { title: 'Test 1' } },
				{ properties: { title: 'Test 2' } },
				{ properties: { title: 'Test 3' } },
			]
		}),
		Ti.UI.createListSection({
			headerView: Ti.UI.createView({ height: 10 }),
			footerView: Ti.UI.createView({ height: 10 }),
			items: [
				{ properties: { title: 'Test 1' } },
				{ properties: { title: 'Test 2' } },
				{ properties: { title: 'Test 3' } },
			]
		})
	]
}));
const nav = Ti.UI.createNavigationWindow({ window });
nav.open();

TableView Test:

  1. Build and run the below on iOS 15.
  2. Note the padding above the 2 section. (Looks like "issue.png" attached to TIMOB-28524.)
  3. Uncomment the sectionHeaderTopPadding: 0.0 line below and re-run.
  4. Notice the extra section padding is gone. (Looks like "fix.png" attached to TIMOB-28524.)
const window = Ti.UI.createWindow({ title: 'Window 1', backgroundColor: '#f0f0f0' });
window.add(Ti.UI.createTableView({
//	sectionHeaderTopPadding: 0.0,
	data: [
		Ti.UI.createTableViewSection({
			headerView: Ti.UI.createView({ height: 10 }),
			footerView: Ti.UI.createView({ height: 10 }),
			rows: [
				Ti.UI.createTableViewRow({ title: 'Test 1' }),
				Ti.UI.createTableViewRow({ title: 'Test 2' }),
				Ti.UI.createTableViewRow({ title: 'Test 3' }),
			]
		}),
		Ti.UI.createTableViewSection({
			headerView: Ti.UI.createView({ height: 10 }),
			footerView: Ti.UI.createView({ height: 10 }),
			rows: [
				Ti.UI.createTableViewRow({ title: 'Test 1' }),
				Ti.UI.createTableViewRow({ title: 'Test 2' }),
				Ti.UI.createTableViewRow({ title: 'Test 3' }),
			]
		})
	]
}));
const nav = Ti.UI.createNavigationWindow({ window });
nav.open();

@build
Copy link
Contributor

build commented Aug 14, 2021

Fails
🚫 Tests have failed, see below for more information.
🚫

🔬 There are library changes, but no changes to the unit tests. That's OK as long as you're refactoring existing code, but will require an admin to merge this PR. Please see README.md#unit-tests for docs on unit testing.

Messages
📖 ✊ The commits in this PR match our conventions! Feel free to Rebase and Merge this PR when ready.
📖 ❌ 2 tests have failed There are 2 tests failing and 938 skipped out of 15477 total tests.
📖 🎉 Another contribution from our awesome community member, hansemannn! Thanks again for helping us make Titanium SDK better. 👍
📖

💾 Here's the generated SDK zipfile.

Tests:

ClassnameNameTimeError
android.emulator.Titanium.UI.View"after all" hook for "rgba fallback" (5.0.2)20.376
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)
android.emulator.Titanium.UI.View"after each" hook for "getOrCreateView() should always return a View" (5.0.2)10.358
Error: Timeout of 10000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)

Generated by 🚫 dangerJS against 8a9a602

Copy link
Contributor

@jquick-axway jquick-axway left a comment

Choose a reason for hiding this comment

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

CR/FR: Pass

Copy link
Collaborator

@ewanharris ewanharris left a comment

Choose a reason for hiding this comment

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

FR Pass

@ewanharris ewanharris merged commit 934c440 into tidev:master Aug 20, 2021
@hansemannn hansemannn deleted the TIMOB-28524 branch August 20, 2021 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants