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 optionDialog cancel option #1383

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

fix: iOS optionDialog cancel option #1383

wants to merge 2 commits into from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented Feb 12, 2024

Alloy:

<Alloy>
    <Window>
        <!-- some other modules, actionbar, views and a listview -->

        <OptionDialog id="dialog" title="Delete item?" onClick="onClickDialog">
            <Options>
                <Option>Yes</Option>
                <Option cancel="true">No</Option>
            </Options>
        </OptionDialog>
    </Window>
</Alloy>

generated

var __alloyId22 = [];
__alloyId22.push("Yes");
__alloyId19 = __alloyId22.push("No") - 1;                    // <- error
$.__views["dialog"] = Ti.UI.createOptionDialog({
  options: __alloyId22,
  cancel: __alloyId19,
  id: "dialog",
  title: "Delete item?"
});

with

[ERROR] TiExceptionHandler:
[ERROR] TiExceptionHandler: ReferenceError: __alloyId19 is not defined
[ERROR] TiExceptionHandler:     at new Controller (/alloy/controllers/machine.js:325:6199)
[ERROR] TiExceptionHandler:     at Object.exports.createController (/alloy.js:427:8)
[ERROR] TiExceptionHandler:     at Button.onClickGo (/alloy/controllers/index.js:251:21)
[ERROR] TiExceptionHandler:     at Button.value (ti:/kroll.js:1430:27)
[ERROR] TiExceptionHandler:     at Button.value (ti:/kroll.js:1477:25)

The <OptionDialog> works fine in a blank project 🤷

This PR will add a var infront of __alloyId19:

var __alloyId22 = [];
__alloyId22.push("Yes");
var __alloyId19 = __alloyId22.push("No") - 1;                    // <- fix
$.__views["dialog"] = Ti.UI.createOptionDialog({
  options: __alloyId22,
  cancel: __alloyId19,
  id: "dialog",
  title: "Delete item?"
});

and the projects builds fine

@m1ga m1ga changed the title fix: optionDialog cancel option fix: iOS optionDialog cancel option Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant