@@ -7,7 +7,12 @@ import {ViewClass, getViewClass, getViewMeta, isKnownView, ViewExtensions, NgVie
7
7
import { getSpecialPropertySetter } from "ui/builder/special-properties" ;
8
8
import { ActionBar , ActionItem , NavigationButton } from "ui/action-bar" ;
9
9
import trace = require( "trace" ) ;
10
+ import { device , platformNames } from "platform" ;
10
11
12
+ const isIos : boolean = device . os === platformNames . ios ;
13
+ const isAndroid : boolean = device . os === platformNames . android ;
14
+ const IOS_PREFX : string = "@ios:" ;
15
+ const ANDROID_PREFX : string = "@android:" ;
11
16
12
17
export const rendererTraceCategory = "ns-renderer" ;
13
18
export function traceLog ( msg ) {
@@ -142,7 +147,33 @@ function isXMLAttribute(name: string): boolean {
142
147
}
143
148
}
144
149
150
+ function platformFilter ( attribute : string ) : string {
151
+ var lowered = attribute . toLowerCase ( ) ;
152
+ if ( lowered . indexOf ( IOS_PREFX ) === 0 ) {
153
+ if ( isIos ) {
154
+ return attribute . substr ( IOS_PREFX . length ) ;
155
+ } else {
156
+ return null ;
157
+ }
158
+ }
159
+
160
+ if ( lowered . indexOf ( ANDROID_PREFX ) === 0 ) {
161
+ if ( isAndroid ) {
162
+ return attribute . substr ( ANDROID_PREFX . length ) ;
163
+ } else {
164
+ return null ;
165
+ }
166
+ }
167
+
168
+ return attribute ;
169
+ }
170
+
145
171
export function setProperty ( view : NgView , attributeName : string , value : any ) : void {
172
+ attributeName = platformFilter ( attributeName ) ;
173
+ if ( ! attributeName ) {
174
+ return ;
175
+ }
176
+
146
177
if ( attributeName . indexOf ( "." ) !== - 1 ) {
147
178
// Handle nested properties
148
179
const properties = attributeName . split ( "." ) ;
0 commit comments