835 Commits

Author SHA1 Message Date
ec24c5a96f fix(list-view): Layout list-view items on request (#6159)
* test: list items relayout example

* fix(list-view): Layout list-view items on request

* refactor(tests): refactor list-view tests imports
2018-08-09 18:19:56 +03:00
6da1b33b50 refactor: update getSupportFragmentManager cast (#6155) 2018-08-07 13:45:48 +03:00
cc19b400b9 fix(android): suppress reflection for default animations (#6141)
Fixes `Error: java.lang.CloneNotSupportedException: Class android.support.v4.app.FragmentManagerImpl$AnimationOrAnimator doesn't implement Cloneable` in specific projects.

Related to #5785
Related to #6129 

BREAKING CHANGE


Before:
Default fragment enter animation was Android version specific

After:
Default fragment enter animation is now fade animation for all Android versions

You can customise the transition per navigation entry or globally via the [navigation transitions API](
https://docs.nativescript.org/core-concepts/navigation#navigation-transitions)
2018-08-02 16:01:52 +03:00
7ebac7c353 fix(iOS-gestures) touch delegate does not call base class touch methods (#6113)
* fix ios Touch gestures super methods not being called on nativeView

* use “this.view”
2018-08-02 11:52:35 +03:00
85b8c018a5 feat(styling): Added 2 functions to control applicationAdditionalSelectors (#6124)
* Added getAdditionalSelectors function so that nativescript-theme can be functional again in NS 4.x

* Change to a better more extensible additional css system.

* removed redunant function on the name.

* Fix lint issues

* Adding mergeSelectors to the remove function

* Added test of new add/remove css functions.

* fix: revert testRunner.ts changes that disabled all tests except style

* refactor: fix typo

* chore: fix typo and change test to no not affect global styles
2018-08-02 11:51:07 +03:00
cf034dd04d feat(android): migrate to support library apis (#6129)
Switch Activity / Fragment / FragmentManager implementation from native framework to support library APIs

BREAKING CHANGE:


NativeScript core framework now extends support library APIs versus native framework classes as per Google's latest guidelines:
- NativeScript activities now extend `android.support.v7.app.AppCompatActivity` (vs android.app.Activity)
- NativeScript fragments now extend `android.support.v4.app.Fragment` (vs android.app.Fragment)
- NativeScript now works internally with `android.support.v4.app.FragmentManager` (vs android.app.FragmentManager) 

The implications of these changes should be mostly transparent to the developer except for the fact that the support library Fragment / FragmentManager work with Animation APIs versus Animator APIs.

For Android API Levels lower than 28 the new Fragment API uses a different fragment enter animation by default. You can customise the transition per navigation entry or globally via the [navigation transitions API](https://docs.nativescript.org/core-concepts/navigation#navigation-transitions)
Before:
Default fragment enter animation was fade animation

After:
Default fragment enter animation for API levels lower than 28 is now a fast "push fade" animation; default fragment enter animation for API levels equal to or greater than 28 remains fade animation

Before:
AndroidFragmentCallbacks interface exposed the following `onCreateAnimator(...)` method
``` ts
export interface AndroidFragmentCallbacks {
    onCreateAnimator(fragment: any, transit: number, enter: boolean, nextAnim: number, superFunc: Function): any;
    // ...
}
```

After:
AndroidFragmentCallbacks interface now exposes the following `onCreateAnimation(...)` method instead (and `onCreateAnimator(...)` is now removed)
``` ts
export interface AndroidFragmentCallbacks {
    onCreateAnimation(fragment: any, transit: number, enter: boolean, nextAnim: number, superFunc: Function): any;
    // ...
}
```

Before:
Transition class exposed the following abstract `createAndroidAnimator(...)` method
``` ts
export class Transition {
    public createAndroidAnimator(transitionType: string): any;
    // ...
}
```

After:
Transition class now exposes the following abstract `createAndroidAnimation(...)` method instead (and `createAndroidAnimation(...) is now removed)
``` ts
export class Transition {
    public createAndroidAnimation(transitionType: string): any;
    // ...
}
```

To migrate the code of your custom transitions follow the example below:

Before:
``` ts
import * as transition from "tns-core-modules/ui/transition";

export class CustomTransition extends transition.Transition {
    constructor(duration: number, curve: any) {
        super(duration, curve);
    }

    public createAndroidAnimator(transitionType: string): android.animation.Animator {
        var scaleValues = Array.create("float", 2);
        switch (transitionType) {
            case transition.AndroidTransitionType.enter:
            case transition.AndroidTransitionType.popEnter:
                scaleValues[0] = 0;
                scaleValues[1] = 1;
                break;
            case transition.AndroidTransitionType.exit:
            case transition.AndroidTransitionType.popExit:
                scaleValues[0] = 1;
                scaleValues[1] = 0;
                break;
        }
        var objectAnimators = Array.create(android.animation.Animator, 2);
        objectAnimators[0] = android.animation.ObjectAnimator.ofFloat(null, "scaleX", scaleValues);
        objectAnimators[1] = android.animation.ObjectAnimator.ofFloat(null, "scaleY", scaleValues);
        var animatorSet = new android.animation.AnimatorSet();
        animatorSet.playTogether(objectAnimators);

        var duration = this.getDuration();
        if (duration !== undefined) {
            animatorSet.setDuration(duration);
        }
        animatorSet.setInterpolator(this.getCurve());

        return animatorSet;
    }
}
```

After:
``` ts
import * as transition from "tns-core-modules/ui/transition";

export class CustomTransition extends transition.Transition {
    constructor(duration: number, curve: any) {
        super(duration, curve);
    }

    public createAndroidAnimation(transitionType: string): android.view.animation.Animation {
        const scaleValues = [];

        switch (transitionType) {
            case transition.AndroidTransitionType.enter:
            case transition.AndroidTransitionType.popEnter:
                scaleValues[0] = 0;
                scaleValues[1] = 1;
                break;
            case transition.AndroidTransitionType.exit:
            case transition.AndroidTransitionType.popExit:
                scaleValues[0] = 1;
                scaleValues[1] = 0;
                break;
        }
            
        const animationSet = new android.view.animation.AnimationSet(false);
        const duration = this.getDuration();
        if (duration !== undefined) {
            animationSet.setDuration(duration);
        }

        animationSet.setInterpolator(this.getCurve());
        animationSet.addAnimation(
            new android.view.animation.ScaleAnimation(
                scaleValues[0], 
                scaleValues[1], 
                scaleValues[0], 
                scaleValues[1]
            ));

        return animationSet;
    }
}
```
2018-07-31 18:48:34 +03:00
88f7ed84d2 fix: iOS TimePicker minuteInterval property (#6116) 2018-07-27 16:19:12 +03:00
9e2e8ec3a1 feat(list-picker): add textField, valueField and selectedValue properties (#6033)
* Added textField, valueField and selectedValue properties

textField and valueField - should be used with arrays of JSON objects
textField - tells the listview which property should be used to display each item
valueField - tells the listview, which property should be used to update the selectedValue
selectedValue - is the property that will contain the selectedValue, if valueField is specified, then it will contain the value from that field, otherwise it will contain the whole selected item

* Example showing textField, valueField and selectedValue in action

* Update import paths
2018-07-23 17:06:01 +03:00
feaf1408a4 chore(android): update AndroidP sdk version check (#6093) 2018-07-23 13:57:14 +03:00
6ce1d22d9a feat(CSS): import of relative paths (#6023)
* feat(CSS): import of relative paths

* refactor: address comments
2018-07-21 05:54:32 +03:00
1fac718a58 feat(UI): Added animated scroll to index for ListView (#6077)
* feat(UI): Added animated scroll to index for ListView

* Update list-view.d.ts
2018-07-19 16:40:59 +03:00
8813e9bc57 fix: require devtools-elements.js with the extension mentioned explicitly (#6079)
This is a workaround for the issue with `@ngtools/webpack@6.1.0-rc.2`, described here: https://github.com/NativeScript/nativescript-dev-webpack/issues/607#issuecomment-405209925
2018-07-18 11:38:22 +01:00
39acaa8e11 Fixing onReceiveError for API level >= 23 (#6056)
* Fixing onReceiveError for API level >= 23

* using @ts-ignore as "super as any" is not a valid statement
2018-07-13 09:50:32 +03:00
324fdcebcd fix(action-bar): #5743 navController may be null (#6029)
* fix(action-bar): #5743 navController may be null

From my own Crashlytics:
`stderr: file:///app/vendor.js:1:860568: JS ERROR TypeError: null is not an object (evaluating 'a.viewControllers')`
```
file:///app/vendor.js:1:860489
var l,p=a.viewControllers.indexOfObject(n);if(p>0&&p<a.viewControllers.count&&(t=a.viewControllers[p-1]),t)
```
which corresponds to:
2fc1d8a8d4/tns-core-modules/ui/action-bar/action-bar.ios.ts (L132)

further up `navController` is checked for truthiness:
2fc1d8a8d4/tns-core-modules/ui/action-bar/action-bar.ios.ts (L119)

So applying same logic.

* Adjusted per request
2018-07-10 13:22:30 +03:00
398c9b3f33 feat(typings): Adding Android typings for API levels from 17 to 27 (#5890)
Adding android typings for API levels from 17 to 27

BREAKING CHANGES:
There is no longer added `I` prefix in the names of the interfaces. For example `android.view.IMenuItem` is now `android.view.MenuItem`. This matches the original name of the interface in the android framework.
2018-07-05 18:36:23 +03:00
bcadcbe7b5 fix(animations): avoid steady mem consumption rise (#6004) 2018-07-04 13:44:01 +03:00
0082dfbdb0 fix(dialogs-ios): dialogs not showing in single page apps (non Frame based apps) (#6000) 2018-07-03 10:23:51 +03:00
b5b8d51b0d fix(modal): parent page invalid hierarchy handling [extended] (#5966)
* fix(modal): parent page invalid hierarchy handling

* refactor(modals): Refactor safe guard in show/hide modal
2018-06-20 16:10:03 +03:00
4b5754a6d4 fix(ios): safeAreaLayoutGuide fallback for iOS 10 cases (#5960) 2018-06-20 07:28:06 +03:00
357c8ecf15 fix(core/properties): Fix typings for nativeValueChange (#5791)
* Fix typings for nativeValueChange

* Update properties.d.ts

Changed parameter name of nativeValueChange from “target” to “owner”
Fixed white space to match coding style

* Update properties.d.ts

Fixed white space
2018-06-19 14:20:55 +03:00
6cfdc206d9 fix(ios): translate transform breaks sequential animation set (#5961)
* fix(ios): translate transform breaks sequential animation set

* chore: add e2e test app for animations
2018-06-19 10:38:29 +03:00
0e04cb4ad1 fix(android): NavigationButton was read as "Button" by screenreaders. (#5949)
The navigation button for the vision-impaired users were always read as:
"Button" by the TalkBack service on Android.
2018-06-14 12:54:33 +03:00
b0afd3ab30 fix(android): prevent error during tear down (#5947) 2018-06-14 10:01:03 +03:00
5cd8a1fc2a fix(Image): catch Response content may not be converted to an Image (#5856)
closes https://github.com/NativeScript/nativescript-angular/issues/851
closes https://github.com/NativeScript/NativeScript/issues/3381
2018-06-13 13:45:54 +03:00
0b9d4aea0a fix(android): label width shrinking on shorter text change (#5917) 2018-06-07 16:44:33 +03:00
b122bd4a37 fix(ios): set current tab as topmost frame on load (#5908) 2018-06-06 14:47:42 +03:00
9308bab172 fix(animation): handle promise rejection and avoid throw (#5861) 2018-05-31 15:58:50 +03:00
e59d1567a5 fix(ios-dialogs): unable to show dialog from modal view without a page (#5881)
* fix(ios-dialogs): unable to show dialog from modal view

* tests(modal-navigation): add test that opens dialog inside modal view
2018-05-29 18:06:02 +03:00
a03065c527 fix(flexbox-ios): resolve text size issue for ListView with flexbox layout template (#5799)
* fix(flexbox-layout-ios): resolve text size issue for ListView with flexbox template

* fix(flexbox-layout-ios): resolve text size issue for ListView
2018-05-25 11:43:00 +03:00
7851629a27 fix: crash at application launch on Android P (#5831)
* fix: crash at application launch on Android P

Reference: https://developer.android.com/preview/restrictions-non-sdk-interfaces

Android P introduces new restrictions on the use of non-SDK interfaces, whether directly, via reflection, or via JNI. These restrictions are applied whenever an app references a non-SDK interface or attempts to obtain its handle using reflection or JNI.

In particular, remove reflection via Class.getDeclaredField() and fallback default transition to fade transition.

* refactor: create default transition based on SDK version

Create default transition and setup default animations based on SDK version.
This is to avoid reflection via Class.getDeclaredMethod() for Android P where it throws.

* refactor: extract isAndroidP method
2018-05-23 14:59:24 +03:00
f9d66de79c fix(styling-gradient): change imports in definition files (#5852) 2018-05-23 09:57:24 +03:00
0fc1547a19 feat(view): introduce LayoutChanged event on every View component (#5825)
* feat(view): introduce LayoutChanged event

* test(view): add LayoutChanged event tests

* chore(view-android): attach to onLayoutChange only if listener attached

* feat(view-android): override on/off in order to attach and detach from OnLayoutChangeListener
2018-05-21 17:22:40 +03:00
f671f778f3 fix(builder): check for custom components registered at build time (#5834) 2018-05-19 11:41:36 +03:00
1365f13594 fix(modal): innerView.closeModal(...) not passing back context (#5833) 2018-05-18 16:50:27 +03:00
3f8af4cc0e fix(styling-gradient): introduce gradient definition file (#5828) 2018-05-17 15:44:40 +03:00
ca444aa8ed fix(android-textfield): returnPress fired twice for GO/SEARCH/SEND (#5727) 2018-05-16 15:13:09 +03:00
a86d41e7db fix(android): fix sporadic issue with transition cleanup logic called twice (#5805) 2018-05-14 18:11:02 +03:00
2fc1d8a8d4 chore(tsc): enable noUnusedLocals compiler option for tns-core-modules (#5755) 2018-05-10 16:12:59 +03:00
9d21a743c4 Revert 5772 revert 5534 css gradients (#5779)
* Revert "Revert "Css gradients" (#5772)"

This reverts commit 7edf56197a179b13e1afe4c706aea4a99ac62aca.

* chore(): fix LinearGradient circular dependency
2018-05-10 10:44:35 +03:00
11f0d6e98d feat(tabview): add tab text font size property (#5752)
* feat(tabview): add tab text font size property

* chore(tabview): set tab font size default value

* chore(tabview): move font implementation to widget

* chore(tabview): fix font size get return type
2018-05-09 17:13:34 +03:00
481043fa2b fix: label text wrapping inside flexbox layout (#5781) 2018-05-08 15:09:52 +03:00
7edf56197a Revert "Css gradients" (#5772)
This reverts commit 5a83a1c858e8095353aa50fe4ea080b07bf85813.
2018-05-03 18:17:07 +03:00
5a83a1c858 Css gradients (#5534)
* feat(ios): Added support for css gradients.

* feat(android): Added support for css gradients.

* fix: Fixed gradient borders on ios

* fix(gradient): added backgroundGradient to View and Style.

* fix(ios-gradients): fixed ios gradients covering view content.

* test(gradient): Added ui app tests for background gradients.

* test(gradient): Added a test ensuring background gradient property is applied to style.

* style(gradient): Fixed tslint errors.

* fix(gradient): Removed the background-gradient property and added the gradient to background-image.

* style: fixed a consecutive blank line tslint error.

* fix(tests): fixed the bug that was causing tests to fail.

* chore(linear-gradient): fix equality comparer

* test(gradient): add linear gradients test app

* chore(tslint): update with latest tslint rules
2018-05-03 13:24:41 +03:00
03cfc0cee3 chore(tslint): update tslint rules and fix errors (#5747)
* chore(tslint): fix tslint config & errors
* chore(tslint): enable double quotes, whitespace, and arrow-return-shorthand rules and fix errors
2018-04-26 18:36:32 +03:00
a767c8efd4 chore(modal): update dts for showModal(...) args (#5734) 2018-04-26 00:20:10 +03:00
451589dbd6 fix(modal): exception when calling ViewBase.showModal(...) (#5737) 2018-04-26 00:19:44 +03:00
49ea10b81e fix(layout): IOS Layout not invalidated with custom root (#5724)
* fix(layout): Buuple up layout trough viewControllers

* test: Layout invalidates correctly with different root view

* chore: tslint
2018-04-23 15:47:27 +03:00
4f5887b0ad fix(android): lollipop crash on changing activity context after navigation w/transition (#5700) 2018-04-20 13:46:03 +03:00
b9806bad1c fix(list-view-ios): fix rowHeight property to apply proper item size for iOS (#5693)
* fix(list-view-ios): fix rowHeight property to apply proper item size for iOS

* chore(apps-tests): add rowHeight tests
2018-04-18 10:47:19 +03:00
6fb7481327 feat(builder): enable reading xml from bundle (#5668) 2018-04-17 17:27:32 +03:00