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

feat(android): Ti.UI.BottomSheet, Ti.UI.BottomSheetDialog #12966

Closed
wants to merge 9 commits into from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Jul 19, 2021

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

As a starting point for Ti.UI.BottomSheet & Ti.UI.BottomSheetDialog:

Example

var win = Ti.UI.createWindow({
	backgroundColor: '#eee'
});
var bottomSheet = Ti.UI.createBottomSheet({
	bottom: 0,
	width: Ti.UI.FILL,
	height: Ti.UI.SIZE,
	peakHeight: 32,
	backgroundColor: "#fff"
});
bottomSheet.addEventListener("stateChanged", function(e) {
	console.log("New state: " + e.state);
})
win.add(bottomSheet);

var view = Ti.UI.createView({
	backgroundColor:"#fff",
	width: Ti.UI.FILL,
	height: Ti.UI.SIZE,
	layout: "vertical",
});
var img = Ti.UI.createImageView({
	image: "/appicon.png",
	width: 100,
	height: 100
});
var lbl = Ti.UI.createLabel({
	text: "Custom label text\nCustom label text\nCustom label text",
	color: "#000"
});
view.add(img);
view.add(lbl);
bottomSheet.add(view);

var btn = Ti.UI.createButton({
	top: 5,
	title: "toggle bottomsheet"
});
btn.addEventListener("click", function() {
	bottomSheet.toggle();
})
win.add(btn);

var btn2 = Ti.UI.createButton({
	top: 50,
	title: "full height"
});
btn2.addEventListener("click", function() {
	bottomSheet.height = Ti.UI.FILL;
	bottomSheet.expand();
})
win.add(btn2);

var btn3 = Ti.UI.createButton({
	top: 100,
	title: "collapse"
});
btn3.addEventListener("click", function() {
	bottomSheet.height = Ti.UI.SIZE;
	bottomSheet.collapse();
})
win.add(btn3);

win.open();

20210719_145537

TODO:

  • Apidoc
  • see what iOS can do and talk about parity
  • tests

@build build added this to the 10.1.0 milestone Jul 19, 2021
@build build requested a review from a team July 19, 2021 13:26
@build
Copy link
Contributor

build commented Jul 19, 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.

Warnings
⚠️

Commit 5d7574615a032d5b150d748d63aa4db0b70509db has a message "nestedScrolling parameter" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit 8259cb0e3c45cd51047921560440a619ebd6fd43 has a message "docu" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit 11b58385073df01c3abc950a7f39a60f755ca975 has a message "color options" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit 0d8ede943f41b993ce3b486ebd651e86d1070722 has a message "icons" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit 2dd6f38fa774c06b622334208058daeb63ff5ac0 has a message "destructive, cancelable" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit c46be21cda4b3eff51f0227b62246c9d29f4350c has a message "BottomSheedDialog" giving 2 errors:

  • subject may not be empty
  • type may not be empty
⚠️

Commit 77874038bd6b0622572f3509374d92936d0e869e has a message "starting the doc" giving 2 errors:

  • subject may not be empty
  • type may not be empty
Messages
📖

🚨 This PR has one or more commits with warnings/errors for commit messages not matching our configuration. You may want to squash merge this PR and edit the message to match our conventions, or ask the original developer to modify their history.

📖 ❌ 1 tests have failed There are 1 tests failing and 737 skipped out of 11857 total tests.
📖 🎉 Another contribution from our awesome community member, m1ga! Thanks again for helping us make Titanium SDK better. 👍

Tests:

ClassnameNameTimeError
ios.iphone.Titanium.UI.iOS.CollisionBehavior.exampleworks (14.4.0)15.001
Error: Timeout of 15000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (app.js)

Generated by 🚫 dangerJS against 5d75746

@build build requested a review from a team July 22, 2021 15:28
@build build added the docs label Jul 22, 2021
@m1ga m1ga changed the title feat(android): Ti.UI.BottomSheet feat(android): Ti.UI.BottomSheet, Ti.UI.BottomSheetDialog Jul 23, 2021
@m1ga
Copy link
Contributor Author

m1ga commented Jul 23, 2021

Name and functions still might change but I've added the Dialog version.

ezgif-2-52bcd8ae9e7c

It will use the normal options:["a","b","c"] syntax or an androidView for a custom view (so it will be like the BottomSheet but as a Dialog).

var bsd = Ti.UI.createBottomSheetDialog({
	title: "My options",
	options: ["option 1", "option 3", "option 4"],
	// androidView: customView
});

@m1ga
Copy link
Contributor Author

m1ga commented Nov 11, 2021

Closing this one here since there are modules now that do that.

@m1ga m1ga closed this Nov 11, 2021
@m1ga m1ga deleted the bottomsheet branch December 10, 2022 17:53
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

2 participants