[TIMOB-26499] iOS: Third-party modules cannot be referenced anymore in Alloy templates
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2018-10-31T18:24:50.000+0000 |
Affected Version/s | Release 7.5.0 |
Fix Version/s | Release 7.5.0 |
Components | iOS |
Labels | n/a |
Reporter | Jan Vennemann |
Assignee | Jan Vennemann |
Created | 2018-10-30T15:55:52.000+0000 |
Updated | 2018-11-06T10:19:55.000+0000 |
Description
*Steps to reproduce the behavior*
Change
Add the following to
Setup a new Alloy project and install the [av.imageview](https://github.com/AndreaVitale/av.imageview) module.
Change app/views/index.xml
to the following template that uses the module inside a list view:
<Alloy>
<Window>
<ListView defaultItemTemplate="custom">
<Templates>
<ItemTemplate name="custom">
<ImageView ns="AvImageview" image="https://via.placeholder.com/150" />
</ItemTemplate>
</Templates>
<ListSection>
<ListItem></ListItem>
</ListSection>
</ListView>
</Window>
</Alloy>
Add the following to app/alloy.js
var AvImageview = require("av.imageview");
*Actual behavior*
The app boots with an JS error:
[ERROR] Failed to load Alloy widget / CommonJS module "AvImageview.ImageView" to be used as template
[ERROR] Script Error {
[ERROR] column = 1036;
[ERROR] line = 58;
[ERROR] message = "Invalid item template type provided";
[ERROR] nativeLocation = "+[TiViewProxy unarchiveFromTemplate:inContext:] (TiViewProxy.m:2994)";
[ERROR] nativeReason = "The item template type provided cannot be resolved.";
[ERROR] nativeStack = "3 global-test-alloy 0x00000001006a0294 global-test-alloy + 590484\n4 global-test-alloy 0x0000000100651b48 global-test-alloy + 269128\n5 global-test-alloy 0x00000001006514dc global-test-alloy + 267484\n6 CoreFoundation 0x00000001a8e6fb0c <redacted> + 216\n7 global-test-alloy 0x00000001006510e8 global-test-alloy + 266472\n8 global-test-alloy 0x0000000100785420 global-test-alloy + 1528864\n9 global-test-alloy 0x000000010078ce20 global-test-alloy + 1560096\n10 global-test-alloy 0x000000010079eae4 global-test-alloy + 1632996\n11 global-test-alloy 0x00000001006bf5dc global-test-alloy + 718300\n12 global-test-alloy 0x000000010079e968 global-test-alloy + 1632616\n13 Foundation 0x00000001a99344ac <redacted> + 272\n14 global-test-alloy 0x000000010069ff64 global-test-alloy + 589668\n15 global-test-alloy 0x000000010069c0b8 global-test-alloy + 573624\n16 global-test-alloy 0x0000000100649420 global-test-alloy + 234528\n17 global-test-alloy 0x000000010079d454 global-test-alloy + 1627220\n18 global-test-alloy 0x000000010069c2d8 global-test-alloy + 574168\n19 global-test-alloy 0x00000001006a2dfc global-test-alloy + 601596";
[ERROR] sourceURL = "file:///var/containers/Bundle/Application/1690C6F2-C45D-41D3-9311-6B917582242A/global-test-alloy.app/alloy/controllers/index.js";
[ERROR] stack = " at [native code]\n at Controller(/alloy/controllers/index.js:58:1036)\n at createController(/alloy.js:339:48)\n at (/app.js:61:23)\n at global code(/app.js:62:70)\n at require@[native code]\n at (/ti.main.js:27:8)\n at loadAsync(/ti.internal/bootstrap.loader.js:148:186)\n at global code(/ti.main.js:24:52)";
[ERROR] toJSON = "<KrollCallback: 0x280108840>";
[ERROR] }
[ERROR] Script Error Module "app.js" failed to leave a valid exports object
*Expected behavior*
The app works as expected and the image is displayed using the module.
*Additional notes*
This works in 7.4.1 and is broken in 7.5.0 due to this change: https://github.com/appcelerator/titanium_mobile/pull/10131
PR (7_5_X): https://github.com/appcelerator/titanium_mobile/pull/10410
PR (master): https://github.com/appcelerator/titanium_mobile/pull/10415