Titanium JIRA Archive
Alloy (ALOY)

[ALOY-1510] Receiving "<SearchView> is only available in Android" when compiling tableview despite platform="android" attribute being present

GitHub Issuen/a
TypeBug
PriorityHigh
StatusResolved
ResolutionFixed
Resolution Date2016-07-27T23:57:04.000+0000
Affected Version/sn/a
Fix Version/salloy 1.9.1, alloy 1.9.2
ComponentsXML
Labelsn/a
ReporterDaniel Pfeiffer
AssigneeHans Knöchel
Created2016-07-27T15:55:30.000+0000
Updated2016-09-09T16:52:56.000+0000

Description

Problem

We have a number of views with tableviews that use the SearchView component. When compiling for iOS, we receive this warning:
[WARN]  <SearchView> is only available in Android
[WARN]  To get rid of this warning, add platform="android" to your <SearchView> element
However, our SearchView elements already have the platform attribute set to "android".

Test case

<Alloy>
    <Window>
        <TableView>
            <SearchBar platform="ios"/>
            <SearchView ns="Ti.UI.Android" platform="android"/>
        </TableView>
    </Window>
</Alloy>

Logs

[INFO] [index.xml] view processing...
[INFO]   style:      "index.tss"
[INFO]   view:       "index.xml"
[WARN] <SearchView> is only available in Android
[WARN] To get rid of this warning, add platform="android" to your <SearchView> element
[INFO]   controller: "index.js"
[TRACE] - Processing "builtins" module...
[TRACE] - Processing "optimizer" module...
[TRACE] - Processing "compress" module...
[INFO]   created:    "Resources/iphone/alloy/controllers/index.js"
[DEBUG]   map:        "build/map/Resources/iphone/alloy/controllers/index.js.map"
[INFO]   created:     "Resources/iphone/alloy/styles/index.js"

Notes

I believe the error is in commands/compile/parsers/Ti.UI.TableView.js:49. It currently reads:
if (node.getAttribute('platform') !== 'android') {
I believe it should read:
if (child.getAttribute('platform') !== 'android') {

Comments

  1. Hans Knöchel 2016-07-27

    Interesting, how does it behave it ListViews? Didn't see the warning there. Thanks! -Please make a PR for Alloy to fix it if possible.- I will make a PR for you.
  2. Hans Knöchel 2016-07-27

    PR: https://github.com/appcelerator/alloy/pull/794
  3. Feon Sua Xin Miao 2016-07-27

    PR merged.

JSON Source