File tree Expand file tree Collapse file tree 5 files changed +28
-2
lines changed
app/ui-tests-app/text-field Expand file tree Collapse file tree 5 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 1+ import { TextField } from "tns-core-modules/ui/text-field" ;
2+ import { TextView } from "tns-core-modules/ui/text-view" ;
3+
4+ export function onLoaded ( args ) {
5+ const page = args . object ;
6+ const textField = < TextField > page . getViewById ( "textField" ) ;
7+ const textView = < TextView > page . getViewById ( "textView" ) ;
8+
9+ attachToEvent ( textField , "blur" ) ;
10+ attachToEvent ( textField , "focus" ) ;
11+ attachToEvent ( textView , "blur" ) ;
12+ attachToEvent ( textView , "focus" ) ;
13+ }
14+
15+ function attachToEvent ( control , event ) {
16+ control . on ( event , ( ) => {
17+ control . text = event + " is thrown" ;
18+ } ) ;
19+ }
Original file line number Diff line number Diff line change 1+ <Page xmlns =" http://www.nativescript.org/tns.xsd" loaded =" onLoaded" >
2+ <StackLayout >
3+ <TextField id =" textField" />
4+ <TextView id =" textView" />
5+ </StackLayout >
6+ </Page >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export function loadExamples() {
1414 examples . set ( "secured-text-field" , "text-field/secured-text-field-4135" ) ;
1515 examples . set ( "max-length" , "text-field/max-length" ) ;
1616 examples . set ( "text-field-border" , "text-field/text-field-border" ) ;
17+ examples . set ( "focus-blur-events" , "text-field/focus-blur-events" ) ;
1718
1819 return examples ;
1920}
Original file line number Diff line number Diff line change 1616 "tns-core-modules" : " *"
1717 },
1818 "devDependencies" : {
19- "tns-platform-declarations" : " *" ,
2019 "babel-traverse" : " 6.10.4" ,
2120 "babel-types" : " 6.11.1" ,
2221 "babylon" : " 6.8.3" ,
2322 "lazy" : " 1.0.11" ,
2423 "nativescript-dev-typescript" : " ^0.3.0" ,
24+ "tns-platform-declarations" : " *" ,
2525 "typescript" : " ~2.2.1"
2626 }
2727}
Original file line number Diff line number Diff line change 1616 "tns-core-modules" : " *"
1717 },
1818 "devDependencies" : {
19- "tns-platform-declarations" : " *" ,
2019 "babel-traverse" : " 6.9.0" ,
2120 "babel-types" : " 6.9.0" ,
2221 "babylon" : " 6.8.0" ,
2322 "filewalker" : " 0.1.2" ,
2423 "lazy" : " 1.0.11" ,
24+ "tns-platform-declarations" : " *" ,
2525 "typescript" : " ~2.2.1"
2626 }
2727}
You can’t perform that action at this time.
0 commit comments