[AC-6492] Hyperloop: weird behavior compiling a project with LiveView enabled
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Open |
| Resolution | Unresolved |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Hyperloop |
| Labels | hyperloop, ios |
| Reporter | Andrea Vitale |
| Assignee | Abir Mukherjee |
| Created | 2020-02-19T14:40:55.000+0000 |
| Updated | 2020-02-26T05:03:10.000+0000 |
Description
Compiling a project with Hyperloop and LiveView doesn't work as expected.
Here is my code:
import { UIView, UIColor, UIBezierPath } from 'UIKit';
import { CAShapeLayer } from 'QuartzCore';
import { CoreGraphics } from 'CoreGraphics';
module.exports = {
createPanelView: function(creationArgs) {
const container = Ti.UI.createView(creationArgs);
const panel = UIView.cast(container);
This is working fine *without* LiveView. Cleaning the project and running it *with* LiveView enabled gives this error:
[ERROR] TypeError: (0, _UIKit.UIView) is not a function. (In '(0, _UIKit.UIView)()', '(0, _UIKit.UIView)' is undefined)
[ERROR] File: app.js
[ERROR] Line: 10
[ERROR] SourceId: undefined
[ERROR] Backtrace:
[ERROR] undefined
If I clean the project, I recompile it *without* LiveView and restart it *with* LiveView (without cleaning it before) everything is working as expected.
Does the
requirenotation work?const UIView = require('UIKit/UIView');Yes, using require it works as expected.
Good to know! I found the same as well but perhaps it was a local problem. I guess it is a transpile problem, and as a workaround you could use the require methods for now.