Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: androidx fragments 1.3+ #9728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 38 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1c79035
chore: ignore local .npmrc
NathanWalker Dec 31, 2021
72b01c2
fix(android): nested frames were sometimes not recreated (#9725)
edusperoni Dec 31, 2021
1b6189b
chore: update workspace dependencies
NathanWalker Dec 31, 2021
37bfb0f
chore: 8.2.0-alpha.0
NathanWalker Dec 31, 2021
089f56d
chore: ensure any local .npmrc is never wiped out
NathanWalker Dec 31, 2021
3cae2c2
fix: androidx fragments 1.3+
edusperoni Jan 3, 2022
c6c3292
fix: qualifier matcher did not support multiple qualifiers for a sing…
CatchABus Jan 4, 2022
4a384ca
feat(types-ios): iOS 15.2 (#9710)
NathanWalker Jan 4, 2022
88e355d
fix: application instance creation occurs only within Application.run
NathanWalker Jan 4, 2022
bb71526
feat: new expression parser for xml bindings (#9729)
CatchABus Jan 6, 2022
55f6151
feat(core): add event when disposeNativeView is called
NathanWalker Jan 6, 2022
c552ce9
fix(time-picker): correction for super.disposeNativeView
NathanWalker Jan 6, 2022
28665f5
feat(gestures): GestureEvents.gestureAttached added to modify native …
NathanWalker Jan 6, 2022
36dc88b
fix: better handling of states
edusperoni Jan 7, 2022
ec1af6a
chore: 8.2.0-alpha.1
NathanWalker Jan 6, 2022
411cdb5
chore: adjust Application ios/android getters
NathanWalker Jan 7, 2022
4172e12
feat(bindable): allow "global" context for expressions inside binding…
CatchABus Jan 14, 2022
2337d29
feat(core): support RGB alpha notation (#9699)
lekhmanrus Jan 14, 2022
06c00d2
feat(root-layout): support gradient colors on shade cover (#9626)
NathanWalker Jan 14, 2022
14c1b05
feat(ui): TouchManager for ease in adding interactivity
NathanWalker Jan 8, 2022
2d7c63d
chore: property
NathanWalker Jan 8, 2022
4e33807
chore: cleanup
NathanWalker Jan 8, 2022
e2efec2
chore: cleanup types
NathanWalker Jan 8, 2022
571bd37
chore: cleanup
NathanWalker Jan 8, 2022
1ae7c56
feat: touch animations demo in toolbox
NathanWalker Jan 10, 2022
18361c0
chore: android demo
NathanWalker Jan 10, 2022
7b44acc
chore: 8.2.0-alpha.3
NathanWalker Jan 11, 2022
a605180
chore: cleanup demo
NathanWalker Jan 14, 2022
e3cd87e
fix: ensure android can access native app instance before bootstrap
NathanWalker Jan 14, 2022
deacc2f
chore: update android manifest settings for demo apps
NathanWalker Jan 14, 2022
33d4424
chore: 8.2.0-alpha.4
NathanWalker Jan 14, 2022
4352ac6
fix(core): Application handling of nativeApp instance
NathanWalker Jan 14, 2022
27e3aa3
feat: improved background handling (#9615)
rigor789 Jan 14, 2022
fb2f508
chore: 8.2.0-alpha.5
NathanWalker Jan 22, 2022
0bcc2cf
chore: cleanup background styling handling
NathanWalker Jan 22, 2022
5adde10
chore: cleanup fragment handling for 1.3+ in addition to older
NathanWalker Jan 22, 2022
3a2cba8
chore: cleanup touchmanager
NathanWalker Jan 22, 2022
e730b5f
Merge branch 'release/8.2.0' into fix/android-fragment-1.3.x
NathanWalker Jan 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ apps/**/*/*.map
apps/**/*/platforms
apps/**/*/webpack.*.js
*.tgz
.npmrc

# System Files
.DS_Store
Expand Down
6 changes: 3 additions & 3 deletions apps/automated/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core"
},
"devDependencies": {
"@nativescript/android": "8.1.1",
"@nativescript/ios": "8.1.0",
"@nativescript/android": "alpha",
"@nativescript/ios": "alpha",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.3.5"
"typescript": "4.5.4"
},
"gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",
"readme": "NativeScript Application"
Expand Down
18 changes: 18 additions & 0 deletions apps/automated/src/color/color-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ export var test_rgb_Color_CSS = function () {
TKUnit.assertEqual(color.argb, 0xffff6464, 'Color.argb not properly parsed');
};

export var test_rgb_Color_CSS_lvl4 = function () {
var alpha = 0.5;
var expected = 0x80;
// <snippet module="color" title="color">
// ### Creating a Color from four RGB values
// ``` JavaScript
// Creates the color with 255 red, 100 green, 100 blue
var color = new Color(`rgb(255 100 100 / ${alpha})`);
// ```
// </snippet>
TKUnit.assertEqual(color.a, expected, 'Color.a not properly parsed');
TKUnit.assertEqual(color.r, 255, 'Color.r not properly parsed');
TKUnit.assertEqual(color.g, 100, 'Color.g not properly parsed');
TKUnit.assertEqual(color.b, 100, 'Color.b not properly parsed');
TKUnit.assertEqual(color.hex, '#FF646480', 'Color.hex not properly parsed');
TKUnit.assertEqual(color.argb, 0x80ff6464, 'Color.argb not properly parsed');
};

export var test_rgba_Color_CSS = function () {
var alpha = 0.5;
var expected = 0x80;
Expand Down
8 changes: 4 additions & 4 deletions apps/automated/src/http/http-string-worker.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// todo: figure out why this worker is including the whole core and not just the Http module
// ie. tree-shaking is not working as expected here. (same setup works in a separate app)
import { initGlobal } from '@nativescript/core/globals/index';
initGlobal();
// import { initGlobal } from '@nativescript/core/globals/index';
// initGlobal();

import { Http } from '@nativescript/core';
import { getString } from '@nativescript/core/http';

declare var postMessage: any;

Http.getString('https://httpbin.org/get').then(
getString('https://httpbin.org/get').then(
function (r) {
postMessage(r);
},
Expand Down
16 changes: 9 additions & 7 deletions apps/automated/src/ui/core/bindable/bindable-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -659,17 +659,19 @@ export function test_BindingConverterCalledEvenWithNullValue() {
const testPropertyValue = null;
const expectedValue = 'collapsed';
pageViewModel.set('testProperty', testPropertyValue);
appModule.getResources()['converter'] = function (value) {
if (value) {
return 'visible';
} else {
return 'collapsed';
}
appModule.getResources()['converter'] = {
toView: function (value) {
if (value) {
return 'visible';
} else {
return 'collapsed';
}
},
};

const testFunc = function (views: Array<View>) {
const testLabel = <Label>views[0];
testLabel.bind({ sourceProperty: 'testProperty', targetProperty: 'text', expression: 'testProperty | converter' });
testLabel.bind({ sourceProperty: 'testProperty', targetProperty: 'text', expression: 'testProperty | converter()' });

const page = <Page>views[1];
page.bindingContext = pageViewModel;
Expand Down
141 changes: 139 additions & 2 deletions apps/automated/src/ui/frame/frame-tests.android.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Frame } from '@nativescript/core/ui/frame';
import { Frame, GridLayout, Label, Page, Trace, View } from '@nativescript/core';
import * as TKUnit from '../../tk-unit';
import { unsetValue } from '@nativescript/core/ui/core/view';
import { PercentLength } from '@nativescript/core/ui/styling/style-properties';
import { buildUIAndRunTest } from '../../ui-helper';
export * from './frame-tests-common';


export function test_percent_width_and_height_set_to_page_support() {
let topFrame = Frame.topmost();
let currentPage = topFrame.currentPage;
Expand Down Expand Up @@ -65,3 +65,140 @@ export function test_percent_margin_set_to_page_support() {
TKUnit.assertTrue(PercentLength.equals(currentPage.marginRight, 0));
TKUnit.assertTrue(PercentLength.equals(currentPage.marginBottom, 0));
}

export function test_nested_frames() {
let topFrame = Frame.topmost();
let currentPage = topFrame.currentPage;
console.log(Frame.topmost(), currentPage);
class PageAbstraction {
page: Page;
root: GridLayout;
setContent(content: View) {
this.root.insertChild(content, 0);
content.marginTop = 30;
}
}

const pageFactory = (color: string) => {
const page = new Page();
page.backgroundColor = color;
const gl = new GridLayout();
const label = new Label();
page.on('navigatedTo', () => {
let depth = 0;
let parent = label.parent;
let parentFrame: Frame = null;
while (parent) {
if (parent instanceof Frame) {
parentFrame = parentFrame || parent;
depth++;
}
parent = parent.parent;
}
label.text = `Depth: ${depth} - Page: ${parentFrame?.backStack.length}`;
});
label.style.zIndex = 999;
gl.insertChild(label, 0);
page.content = gl;
const abs = new PageAbstraction();
abs.root = gl;
abs.page = page;

return abs;
};

const page1 = pageFactory('red');
const page2 = pageFactory('blue');
const page3 = pageFactory('green');
const parentPage2 = pageFactory('yellow');

const frameFactory = () => {
const frame = new Frame();
frame._popFromFrameStack();
frame.navigate = function (...args) {
// console.log('navigateTo', args, args[0].create().backgroundColor);
Frame.prototype.navigate.call(frame, ...args);
this._popFromFrameStack();
};
frame.goBack = function (...args) {
// console.log('goBack', args);
Frame.prototype.goBack.call(frame, ...args);
this._popFromFrameStack();
};
frame.on('navigatingTo', () => ((frame as any).__midNav = true));
frame.on('navigatedTo', () => ((frame as any).__midNav = false));
return frame;
};

const innerFrame = frameFactory();
const innerFrame2 = frameFactory();
page1.setContent(innerFrame2);

innerFrame.navigate({
create: () => {
return page1.page;
},
});

innerFrame2.navigate({
create: () => {
return page2.page;
},
});
function validateState(frame: Frame) {
TKUnit.waitUntilReady(() => (frame as any).__midNav === false, 1);
TKUnit.assertTrue(frame._executingContext == null);
TKUnit.assertTrue(frame._currentEntry != null);
if (frame.isLoaded) {
TKUnit.assertTrue(frame._currentEntry.fragment != null);
}
}
// TKUnit.wait(1);
buildUIAndRunTest(innerFrame, ([parentFrame, parentPage]) => {
Trace.enable();
Trace.setCategories(Trace.categories.concat(Trace.categories.NativeLifecycle, Trace.categories.Transition));
validateState(innerFrame);
validateState(innerFrame2);
innerFrame2.navigate({
create: () => {
return page3.page;
},
});
validateState(innerFrame);
validateState(innerFrame2);
innerFrame.navigate({
create: () => parentPage2.page,
});
validateState(innerFrame);
validateState(innerFrame2);
innerFrame.goBack();
validateState(innerFrame);
validateState(innerFrame2);
innerFrame2.goBack();
validateState(innerFrame);
validateState(innerFrame2);
innerFrame.navigate({
create: () => parentPage2.page,
});
validateState(innerFrame);
validateState(innerFrame2);
innerFrame.goBack();
validateState(innerFrame);
validateState(innerFrame2);

// innerFrame.navigate({
// create: () => parentPage2.page,
// });
// TKUnit.wait(1);
// innerFrame.goBack();
// TKUnit.wait(1);
// TKUnit.assertTrue(innerFrame2._currentEntry.fragment != null);
// TKUnit.wait(5);
});

// TKUnit.waitUntilReady(() => {
// return innerFrame.isLayoutValid;
// }, 1);

TKUnit.wait(10);
}
40 changes: 23 additions & 17 deletions apps/automated/src/ui/list-view/list-view-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,15 +437,17 @@ export class ListViewTest extends UITest<ListView> {
public test_usingAppLevelConvertersInListViewItems() {
var listView = this.testView;

var dateConverter = function (value, format) {
var result = format;
var day = value.getDate();
result = result.replace('DD', day < 10 ? '0' + day : day);
var month = value.getMonth() + 1;
result = result.replace('MM', month < 10 ? '0' + month : month);
result = result.replace('YYYY', value.getFullYear());

return result;
var dateConverter = {
toView: function (value, format) {
var result = format;
var day = value.getDate();
result = result.replace('DD', day < 10 ? '0' + day : day);
var month = value.getMonth() + 1;
result = result.replace('MM', month < 10 ? '0' + month : month);
result = result.replace('YYYY', value.getFullYear());

return result;
},
};

Application.getResources()['dateConverter'] = dateConverter;
Expand Down Expand Up @@ -565,10 +567,12 @@ export class ListViewTest extends UITest<ListView> {
var listView = this.testView;
var converterCalledCounter = 0;

var testConverter = function (value) {
converterCalledCounter++;
var testConverter = {
toView: function (value) {
converterCalledCounter++;

return value;
return value;
},
};

Application.getResources()['testConverter'] = testConverter;
Expand All @@ -578,7 +582,7 @@ export class ListViewTest extends UITest<ListView> {
listView.bindingContext = listViewModel;

listView.bind({ sourceProperty: 'items', targetProperty: 'items' });
listView.itemTemplate = '<Label id="testLabel" text="{{ $value, $value | testConverter }}" />';
listView.itemTemplate = '<Label id="testLabel" text="{{ $value, $value | testConverter() }}" />';

this.waitUntilListViewReady();

Expand All @@ -589,10 +593,12 @@ export class ListViewTest extends UITest<ListView> {
var listView = this.testView;
var converterCalledCounter = 0;

var testConverter = function (value) {
converterCalledCounter++;
var testConverter = {
toView: function (value) {
converterCalledCounter++;

return value;
return value;
},
};

Application.getResources()['testConverter'] = testConverter;
Expand All @@ -602,7 +608,7 @@ export class ListViewTest extends UITest<ListView> {
listView.bindingContext = listViewModel;

listView.bind({ sourceProperty: 'items', targetProperty: 'items' });
listView.itemTemplate = '<StackLayout><Label id="testLabel" text="{{ $value, $value | testConverter }}" /></StackLayout>';
listView.itemTemplate = '<StackLayout><Label id="testLabel" text="{{ $value, $value | testConverter() }}" /></StackLayout>';

this.waitUntilListViewReady();

Expand Down
22 changes: 12 additions & 10 deletions apps/automated/src/ui/repeater/repeater-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,17 @@ export function test_splice_observable_array_refreshes_the_Repeater() {
export function test_usingAppLevelConvertersInRepeaterItems() {
var repeater = new Repeater();

var dateConverter = function (value, format) {
var result = format;
var day = value.getDate();
result = result.replace('DD', month < 10 ? '0' + day : day);
var month = value.getMonth() + 1;
result = result.replace('MM', month < 10 ? '0' + month : month);
result = result.replace('YYYY', value.getFullYear());

return result;
var dateConverter = {
toView: function (value, format) {
var result = format;
var day = value.getDate();
result = result.replace('DD', month < 10 ? '0' + day : day);
var month = value.getMonth() + 1;
result = result.replace('MM', month < 10 ? '0' + month : month);
result = result.replace('YYYY', value.getFullYear());

return result;
},
};

Application.getResources()['dateConverter'] = dateConverter;
Expand All @@ -275,7 +277,7 @@ export function test_usingAppLevelConvertersInRepeaterItems() {

TKUnit.waitUntilReady(() => repeater.isLayoutValid);

TKUnit.assertEqual(getChildAtText(repeater, 0), dateConverter(new Date(), 'DD.MM.YYYY'), 'element');
TKUnit.assertEqual(getChildAtText(repeater, 0), dateConverter.toView(new Date(), 'DD.MM.YYYY'), 'element');
}

helper.buildUIAndRunTest(repeater, testAction);
Expand Down
4 changes: 4 additions & 0 deletions apps/automated/src/ui/styling/style-properties-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export function test_setting_borderColorRGB_property_from_CSS_is_applied_to_Styl
test_property_from_CSS_is_applied_to_style('borderColor', 'border-color', new Color('#FF0000'), 'rgb(255, 0, 0)');
}

export function test_setting_borderColorRGBLvl4_property_from_CSS_is_applied_to_Style() {
test_property_from_CSS_is_applied_to_style('borderColor', 'border-color', new Color('#FF0000'), 'rgb(255 0 0 / 1)');
}

export function test_setting_borderColorRGBA_property_from_CSS_is_applied_to_Style() {
test_property_from_CSS_is_applied_to_style('borderColor', 'border-color', new Color('#FF0000'), 'rgba(255,0,0,1)');
}
Expand Down
6 changes: 3 additions & 3 deletions apps/toolbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"nativescript-theme-core": "file:../../node_modules/nativescript-theme-core"
},
"devDependencies": {
"@nativescript/android": "8.1.1",
"@nativescript/ios": "8.1.0",
"@nativescript/android": "alpha",
"@nativescript/ios": "alpha",
"@nativescript/webpack": "file:../../dist/packages/nativescript-webpack.tgz",
"typescript": "4.3.5"
"typescript": "4.5.4"
}
}
3 changes: 3 additions & 0 deletions apps/toolbox/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
The following CSS rule changes the font size of all UI
components that have the btn class name.
*/
Button {
text-transform: none;
}
.btn-view-demo {
background-color: #65ADF1;
border-radius: 5;
Expand Down
Loading