Titanium JIRA Archive
Alloy (ALOY)

[ALOY-983] Popover height and width are ignored when using ContentView element

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-05-05T18:57:45.000+0000
Affected Version/sAlloy 1.4.0
Fix Version/sAlloy 1.4.0
ComponentsXML
Labelsqe-testadded
ReporterBenjamin Hatfield
AssigneeTim Poulsen
Created2014-04-08T20:27:00.000+0000
Updated2014-06-22T13:21:05.000+0000

Description

ENVIRONMENT: Alloy from master (commit 2267d1d002d7f7bd1f9b61557c11c8d24f259a45/Tue Mar 25 17:31:19 2014 -0400) Titanium SDK 3.3.0.v20140328110920 Appcelerator Studio, build: 3.3.0.201403281814 Mac OS X 10.8.5 Xcode 5.0.2/iOS 7.0.3/iPad Retina simulator REPRODUCTION: Create a new Alloy project and run the code below with the iPad simulator. RESULTS: When using the Popover's contentView (ContentView XML element), height and width properties together, the height and width are not respected with Alloy projects. If you do not set the contentView property, the height and width are honored. Alloy Example
<!-- app/views/index.xml -->
<Alloy>
    <Window>
        <Button id="button" onClick="openPopover">Show Popover!</Button>
    </Window>
</Alloy>

<!-- app/views/popover.xml -->
<Alloy>
    <Popover id="popover" height='100' width='250'>
        <!-- If you remove the ContentView tags, it works as expected -->
        <ContentView>
	    <View id="popView" backgroundColor='green'>
	        <Label>Alloy Popover!</Label>
	    </View>
	</ContentView>
    </Popover>
</Alloy>

// app/controllers/index.js
function openPopover() {
    var popover = Alloy.createController('popover').getView();
    popover.show({view:$.button});
};

$.index.open();
Titanium Classic Example -- works as expected
var win = Ti.UI.createWindow();
var button = Ti.UI.createButton({title: 'Show Popover'});

var popView =  Ti.UI.createView({
	backgroundColor: 'green'
});
var label = Ti.UI.createLabel({text: 'Titanium Popover!'});
popView.add(label);

var popover = Ti.UI.iPad.createPopover({
	width: 250,
	height: 100,
	contentView: popView
});

button.addEventListener('click', function(e){
	popover.show({view: button});
});

win.add(button);
win.open();

Attachments

FileDateSize
AlloyPopoverExample.png2014-04-08T20:28:00.000+000054840
TitaniumPopoverExample.png2014-04-08T20:28:00.000+000051881

Comments

  1. Tim Poulsen 2014-05-02

    PR: https://github.com/appcelerator/alloy/pull/383 Functional test: Run the app included in the PR (https://github.com/skypanther/alloy/tree/ALOY-983/test/apps/testing/ALOY-983) on the iPad simulator or device. There are three buttons. Click on each. They open a popover that uses the ContentView tag containing a View, Window, and NavigationWindow. The height/width of the parent ( tag) is applied to if one is not set directly on ContentView. The NavigationWindow popover is taller because of an explicit height. Also, run the ui/popover test app included in the main Alloy repo on an iPad sim/device. It has two buttons: one creates a popover without a ContentView, the other with a ContentView. You should get a Warn message with the non-ContentView example that such a technique is deprecated.
  2. Tim Poulsen 2014-05-05

    PR merged
  3. Lokesh Choudhary 2014-05-10

    Verified the fix. The functional test instructions pass. Closing. Environment: Appc Studio : 3.2.3.201404181520 Ti SDK : 3.3.0.v20140508223312 Mac OSX : 10.8.5 Alloy : 1.4.0-dev CLI - 3.3.0-dev Ipad simulator

JSON Source