Skip to content

Commit 62d04f7

Browse files
committed
Merge branch 'master' of github.com:nativescript-community/nativescript-collectionview
2 parents 5003694 + f5dd3a2 commit 62d04f7

File tree

77 files changed

+5637
-5779
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5637
-5779
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ yarn-error.log*
2424
.gradle
2525
.project
2626
.yarn
27+
.cxx
2728
tmp/
2829

2930
!.eslintrc.js
@@ -34,6 +35,7 @@ tmp/
3435
devices.js
3536

3637
*.framework
38+
*.xcframework
3739
**/*.js.map
3840
src/**/*.js
3941
packages/**/*.js

.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ nmHoistingLimits: workspaces
22

33
nodeLinker: node-modules
44

5-
yarnPath: tools/.yarn/releases/yarn-3.3.1.cjs
5+
yarnPath: tools/.yarn/releases/yarn-3.6.4.cjs

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
## [5.3.2](https://github.com/@nativescript-community/ui-collectionview/compare/v5.3.1...v5.3.2) (2023-10-20)
7+
8+
### Bug Fixes
9+
10+
* **android:** disable update animation ([ed97594](https://github.com/@nativescript-community/ui-collectionview/commit/ed97594ed6238bcb0da26a9102b024780d454cde))
11+
* **android:** ignore recycled holders in `eachChild` calls ([996bee4](https://github.com/@nativescript-community/ui-collectionview/commit/996bee4fd73510ad17db239aeb6cd02b8725f34d))
12+
13+
## [5.3.1](https://github.com/@nativescript-community/ui-collectionview/compare/v5.3.0...v5.3.1) (2023-10-18)
14+
15+
**Note:** Version bump only for package ui-collectionview
16+
17+
# [5.3.0](https://github.com/@nativescript-community/ui-collectionview/compare/v5.2.0...v5.3.0) (2023-10-18)
18+
19+
### Bug Fixes
20+
21+
* a bunch of fixes to make collectionview faster ([cc550d7](https://github.com/@nativescript-community/ui-collectionview/commit/cc550d74626dfe58ff6c593cfc89b3c189771ded))
22+
* **android:** regression fixes ([fda4f74](https://github.com/@nativescript-community/ui-collectionview/commit/fda4f74b47ac7a0e21d351f3c600828c1c69a2dd))
23+
* **android:** removed animation lib for now ([b0343f8](https://github.com/@nativescript-community/ui-collectionview/commit/b0343f85fdd2ca5d415bdc7fffd3467ecff0f12c))
24+
* vue3 component improvement. Should be much faster ([7bc0498](https://github.com/@nativescript-community/ui-collectionview/commit/7bc0498586db2e931635b62706b26d8eca608284))
25+
26+
### Features
27+
28+
* **android:** layoutCompleted event ([3a239a3](https://github.com/@nativescript-community/ui-collectionview/commit/3a239a3473de25f8d287ea9e7f71d3a2a7449dac))
29+
630
# [5.2.0](https://github.com/@nativescript-community/ui-collectionview/compare/v5.1.9...v5.2.0) (2023-09-12)
731

832
### Bug Fixes

demo-ng

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<script lang="ts">
2+
import { ObservableArray, View } from '@nativescript/core';
3+
import { Template } from 'svelte-native/components';
4+
import ResizeView from './ResizeView.svelte';
5+
6+
let items = new ObservableArray([
7+
{ index: 0, name: 'TURQUOISE', color: '#1abc9c' },
8+
{ index: 1, name: 'EMERALD', color: '#2ecc71' },
9+
{ index: 2, name: 'PETER RIVER', color: '#3498db' },
10+
{ index: 3, name: 'AMETHYST', color: '#9b59b6' },
11+
{ index: 4, name: 'WET ASPHALT', color: '#34495e' },
12+
{ index: 5, name: 'GREEN SEA', color: '#16a085' },
13+
{ index: 6, name: 'NEPHRITIS', color: '#27ae60' },
14+
{ index: 7, name: 'BELIZE HOLE', color: '#2980b9' },
15+
{ index: 8, name: 'WISTERIA', color: '#8e44ad' },
16+
{ index: 9, name: 'MIDNIGHT BLUE', color: '#2c3e50' },
17+
{ index: 10, name: 'SUN FLOWER', color: '#f1c40f' },
18+
{ index: 11, name: 'CARROT', color: '#e67e22' },
19+
{ index: 12, name: 'ALIZARIN', color: '#e74c3c' },
20+
{ index: 13, name: 'CLOUDS', color: '#ecf0f1' },
21+
{ index: 14, name: 'CONCRETE', color: '#95a5a6' },
22+
{ index: 15, name: 'ORANGE', color: '#f39c12' },
23+
{ index: 16, name: 'PUMPKIN', color: '#d35400' },
24+
{ index: 17, name: 'POMEGRANATE', color: '#c0392b' },
25+
{ index: 18, name: 'SILVER', color: '#bdc3c7' },
26+
{ index: 19, name: 'ASBESTOS', color: '#7f8c8d' }
27+
]);
28+
</script>
29+
30+
<page>
31+
<actionBar title="Resize Cell" />
32+
<gridLayout rows="auto,*">
33+
<collectionView {items} row="1" autoReloadItemOnLayout={true}>
34+
<Template let:item>
35+
<!-- it is important to use a custom component
36+
the reason is that for this to work in collectionview
37+
upon resize animation the Svelte component needs to update its "height" property
38+
otherwise Collectionview bind will report wrong height on cell reuse -->
39+
<ResizeView {item}/>
40+
</Template>
41+
</collectionView>
42+
</gridLayout>
43+
</page>
44+
45+
<style>
46+
ActionBar {
47+
background-color: #ed3e04;
48+
color: white;
49+
}
50+
.item {
51+
padding: 10;
52+
color: white;
53+
}
54+
.title {
55+
font-size: 17;
56+
font-weight: bold;
57+
}
58+
.subtitle {
59+
font-size: 14;
60+
}
61+
</style>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<script lang="ts">
2+
import { View } from '@nativescript/core';
3+
export let item;
4+
5+
$: height = item.showMenu === true ? 200 : 100;
6+
7+
async function resizeCell(event) {
8+
try {
9+
async function animate(options = {}) {
10+
const newHeight = !item.showMenu ? 200 : 100;
11+
return (event.object as View).animate({ height: newHeight, ...options, duration: 300 });
12+
}
13+
await animate();
14+
// we update it after so that the svelte component also updates its value
15+
item.showMenu = !item.showMenu;
16+
} catch (error) {
17+
console.error(error);
18+
}
19+
}
20+
</script>
21+
22+
<gridlayout rows="101,100" on:tap={resizeCell} height={height}>
23+
<stacklayout row="0" class="item" backgroundColor={item.color}>
24+
<label row="1" text={item.name} class="title" />
25+
<label row="1" text={item.color} class="subtitle" />
26+
</stacklayout>
27+
<stacklayout row="1" orientation="horizontal" height="100">
28+
<label text="a" width="100" height="100%" backgroundColor="red" textAlignment="center" />
29+
<label text="b" width="100" height="100%" backgroundColor="blue" textAlignment="center" />
30+
</stacklayout>
31+
</gridlayout>

demo-snippets/svelte/install.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
import CollectionViewElement from '@nativescript-community/ui-collectionview/svelte';
2+
import {CollectionViewTraceCategory} from '@nativescript-community/ui-collectionview';
23
import install from '@nativescript-community/ui-collectionview-waterfall';
34
import SwipeMenuElement from '@nativescript-community/ui-collectionview-swipemenu/svelte';
5+
import {Trace} from '@nativescript/core';
46

57
import SimpleGrid from './SimpleGrid.svelte';
68
import HorizontalGrid from './HorizontalGrid.svelte';
79
import SimpleWaterfall from './SimpleWaterfall.svelte';
810
import SimpleTemplates from './SimpleTemplates.svelte';
911
import SwipeMenu from './SwipeMenu.svelte';
12+
import ResizeCell from './ResizeCell.svelte';
1013

1114
export function installPlugin() {
1215
CollectionViewElement.register();
@@ -19,5 +22,9 @@ export const demos = [
1922
{ name: 'Horizontal Grid', path: 'horizontal-grid', component: HorizontalGrid },
2023
{ name: 'Simple Waterfall', path: 'simple-waterfall', component: SimpleWaterfall },
2124
{ name: 'Simple Templates', path: 'simple-templates', component: SimpleTemplates },
22-
{ name: 'SwipeMenu', path: 'swipe-menu', component: SwipeMenu }
25+
{ name: 'SwipeMenu', path: 'swipe-menu', component: SwipeMenu },
26+
{ name: 'ResizeCell', path: 'resize-cell', component: ResizeCell }
2327
];
28+
29+
// Trace.addCategories(CollectionViewTraceCategory)
30+
// Trace.enable()

demo-snippets/vue/ResizeCell.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
</GridLayout> -->
1919
<CollectionView :items="items" ref="collectionView" row="1" :autoReloadItemOnLayout="true">
2020
<v-template>
21+
22+
<!-- TODO: it needs to be a custom Vue component for the component height to update it s value for height upon finished animation -->
2123
<GridLayout class="item" rows="101,100" @tap="resizeCell(item, $event)" :height="getItemHeight(item)" :backgroundColor="item.color">
2224
<Stacklayout row="0">
2325
<Label row="1" :text="item.name" class="title" />

demo-svelte

docs/assets/main.js

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)