* chore: update versions
* Update README.md
* docs: add changelog for 4.2.0 (#6165)
* chore: update versions
* chore: update versions
* chore: set versions of packages to 4.2.0
The versions of packages to reflect in `master` to reflect the `latest` official release in `npm`.
Bumping up versions will execute in CI job through the `npm --no-git-tag-version version minor` command.
This is to unify the release process across the `NativeScript`, `nativescript-angular` and `nativescript-dev-webpack` repositories.
* chore: add npm version script
* docs: add release section to CONTRIBUTING.md
* chore: update npm version script
* chore(deps): update to widgets@next
* chore(deps): update to widgets@next
* docs(CONTRIBUTING): update Releasing new versions section
Add a note that these instructions concern NativeScript Core Team Members.
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)
* 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
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;
}
}
```
* 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
* 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
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.
* feat: Pass NS app native controller to the native app instead of presenting it over the rootViewController
When NativeScript embedded app is created from the native one we check for whether the topmost UIViewController has NativeScriptEmbedder protocol (implemented in the iOS Runtime) method 'presentNativeScriptApp:'. If yes, we call it with the NS app viewcontroller as a parameter so the embedder has control over the NS app (where and how to present it etc.) For backwards compatibility we present the NS app on top of the topmost UIViewController as a fallback.
* style: Fix lint errors
* feat: Check for protocol instead of selector in embedding
I
* Check for rootController instead of topViewController to prevent crash if !rootController
* feat: Introduce NativeScriptEmbedder singleton
NativeScriptEmbedder is responsive for communication between the NS and the native iOS app. His delegate will implement methods which we can call from javascript such as "presentNativeScriptApp:".
* 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