@lynx-example/lynx-ui-swiper 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BasicDynamic/index.tsx +66 -74
- package/BasicUpdateSize/index.tsx +65 -75
- package/Bounces/index.tsx +71 -55
- package/Bounces/styles.css +36 -27
- package/CHANGELOG.md +16 -0
- package/Common/Demo/styles.css +113 -0
- package/Custom/index.tsx +43 -41
- package/CustomScale/index.tsx +44 -42
- package/DifferentHeight/Button.tsx +1 -29
- package/Direction/index.tsx +99 -105
- package/EmptyDataBug/index.tsx +2 -1
- package/EmptyDataBug/styles.css +19 -12
- package/Indicator/index.tsx +56 -50
- package/Lazy/index.tsx +69 -65
- package/Loop/index.tsx +45 -42
- package/RTL/Button.tsx +1 -29
- package/RTL/index.tsx +74 -83
- package/RTLCustom/index.tsx +45 -43
- package/RTLLoop/Button.tsx +1 -29
- package/RTLLoop/index.tsx +57 -66
- package/RTLLoopLynxRTL/Button.tsx +1 -29
- package/RTLLoopLynxRTL/index.tsx +57 -66
- package/WithGap/Button.tsx +1 -29
- package/WithGap/index.tsx +57 -68
- package/dist/SwiperBasic.lynx.bundle +0 -0
- package/dist/SwiperBasic.web.bundle +1 -1
- package/dist/SwiperBasicDynamic.lynx.bundle +0 -0
- package/dist/SwiperBasicDynamic.web.bundle +1 -1
- package/dist/SwiperBasicUpdateSize.lynx.bundle +0 -0
- package/dist/SwiperBasicUpdateSize.web.bundle +1 -1
- package/dist/SwiperBounces.lynx.bundle +0 -0
- package/dist/SwiperBounces.web.bundle +1 -1
- package/dist/SwiperCustom.lynx.bundle +0 -0
- package/dist/SwiperCustom.web.bundle +1 -1
- package/dist/SwiperCustomScale.lynx.bundle +0 -0
- package/dist/SwiperCustomScale.web.bundle +1 -1
- package/dist/SwiperCustomTinder.lynx.bundle +0 -0
- package/dist/SwiperCustomTinder.web.bundle +1 -1
- package/dist/SwiperDifferentHeight.lynx.bundle +0 -0
- package/dist/SwiperDifferentHeight.web.bundle +1 -1
- package/dist/SwiperEmptyDataBug.lynx.bundle +0 -0
- package/dist/SwiperEmptyDataBug.web.bundle +1 -1
- package/dist/SwiperIndicator.lynx.bundle +0 -0
- package/dist/SwiperIndicator.web.bundle +1 -1
- package/dist/SwiperLazy.lynx.bundle +0 -0
- package/dist/SwiperLazy.web.bundle +1 -1
- package/dist/SwiperLoop.lynx.bundle +0 -0
- package/dist/SwiperLoop.web.bundle +1 -1
- package/dist/SwiperRTL.lynx.bundle +0 -0
- package/dist/SwiperRTL.web.bundle +1 -1
- package/dist/SwiperRTLCustom.lynx.bundle +0 -0
- package/dist/SwiperRTLCustom.web.bundle +1 -1
- package/dist/SwiperRTLLoop.lynx.bundle +0 -0
- package/dist/SwiperRTLLoop.web.bundle +1 -1
- package/dist/SwiperRTLLynxRTL.lynx.bundle +0 -0
- package/dist/SwiperRTLLynxRTL.web.bundle +1 -1
- package/dist/SwiperWithGap.lynx.bundle +0 -0
- package/dist/SwiperWithGap.web.bundle +1 -1
- package/package.json +2 -2
- package/BasicDynamic/styles.css +0 -47
- package/BasicUpdateSize/styles.css +0 -47
- package/Custom/styles.css +0 -47
- package/CustomScale/styles.css +0 -41
- package/Direction/styles.css +0 -41
- package/Indicator/styles.css +0 -41
- package/Lazy/styles.css +0 -41
- package/Loop/styles.css +0 -41
- package/RTL/styles.css +0 -41
- package/RTLCustom/styles.css +0 -41
- package/RTLLoop/styles.css +0 -41
- package/RTLLoopLynxRTL/styles.css +0 -41
- package/WithGap/styles.css +0 -47
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
@import "@lynx-js/luna-styles/index.css";
|
|
2
|
+
|
|
3
|
+
.demo-container {
|
|
4
|
+
background-color: var(--canvas);
|
|
5
|
+
display: flex;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.demo-scroll-container {
|
|
13
|
+
background-color: var(--canvas);
|
|
14
|
+
width: 100%;
|
|
15
|
+
height: 100%;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.expand {
|
|
19
|
+
flex: 1;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.top-area {
|
|
23
|
+
height: 54px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.content-area {
|
|
28
|
+
display: flex;
|
|
29
|
+
background: linear-gradient(
|
|
30
|
+
0deg,
|
|
31
|
+
var(--gradient-a),
|
|
32
|
+
var(--gradient-b)
|
|
33
|
+
);
|
|
34
|
+
padding-top: 96px;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
justify-content: center;
|
|
37
|
+
align-items: center;
|
|
38
|
+
row-gap: 24px;
|
|
39
|
+
padding-bottom: 12px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.content-area--compact {
|
|
43
|
+
padding-top: 48px;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.operation {
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: row;
|
|
49
|
+
gap: 16px;
|
|
50
|
+
padding: 32px 16px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.sub-operation {
|
|
54
|
+
display: flex;
|
|
55
|
+
flex: 1;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
gap: 8px;
|
|
58
|
+
padding: 0 16px 72px 16px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.demo-status {
|
|
62
|
+
display: flex;
|
|
63
|
+
flex-direction: column;
|
|
64
|
+
gap: 4px;
|
|
65
|
+
padding: 12px 16px;
|
|
66
|
+
margin: 0 16px;
|
|
67
|
+
border-radius: 8px;
|
|
68
|
+
background-color: var(--neutral-ambient);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.demo-status-text {
|
|
72
|
+
color: var(--content-muted);
|
|
73
|
+
font-size: 12px;
|
|
74
|
+
line-height: 16px;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.demo-section {
|
|
78
|
+
padding: 0 16px 32px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.demo-section-title {
|
|
82
|
+
color: var(--content);
|
|
83
|
+
font-size: 16px;
|
|
84
|
+
font-weight: 600;
|
|
85
|
+
line-height: 20px;
|
|
86
|
+
margin-bottom: 8px;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.demo-section-description {
|
|
90
|
+
color: var(--content-muted);
|
|
91
|
+
font-size: 12px;
|
|
92
|
+
line-height: 16px;
|
|
93
|
+
margin-bottom: 16px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.bounce-item {
|
|
97
|
+
display: flex;
|
|
98
|
+
height: 100%;
|
|
99
|
+
width: 72px;
|
|
100
|
+
align-items: center;
|
|
101
|
+
justify-content: center;
|
|
102
|
+
border-width: 1px;
|
|
103
|
+
border-color: var(--line);
|
|
104
|
+
border-radius: 8px;
|
|
105
|
+
background-color: var(--neutral-ambient);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.bounce-item-text {
|
|
109
|
+
color: var(--content-muted);
|
|
110
|
+
font-size: 12px;
|
|
111
|
+
line-height: 16px;
|
|
112
|
+
text-align: center;
|
|
113
|
+
}
|
package/Custom/index.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
|
|
5
|
-
import { root, useRef } from '@lynx-js/react'
|
|
5
|
+
import { root, useRef, useState } from '@lynx-js/react'
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
Swiper,
|
|
@@ -12,9 +12,12 @@ import {
|
|
|
12
12
|
} from '@lynx-js/lynx-ui'
|
|
13
13
|
import type { SwiperRef } from '@lynx-js/lynx-ui'
|
|
14
14
|
|
|
15
|
-
import '
|
|
15
|
+
import { Card } from '../Common/Card'
|
|
16
|
+
import { Indicator } from '../Common/Indicator'
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
import '../Common/Demo/styles.css'
|
|
19
|
+
|
|
20
|
+
const itemArr: number[] = [1, 2, 3, 4, 5]
|
|
18
21
|
|
|
19
22
|
function customAnimation(value: number, _index: number) {
|
|
20
23
|
'main thread'
|
|
@@ -36,48 +39,47 @@ function customAnimationFirstScreen(value: number, _index: number) {
|
|
|
36
39
|
|
|
37
40
|
function SwiperEntry(): JSX.Element {
|
|
38
41
|
const swiperRef = useRef<SwiperRef>(null)
|
|
42
|
+
const [currentIndex, setCurrentIndex] = useState(0)
|
|
39
43
|
|
|
40
44
|
return (
|
|
41
|
-
<view
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
alignItems: 'center',
|
|
66
|
-
}}
|
|
67
|
-
>
|
|
68
|
-
<view
|
|
45
|
+
<view className='demo-container lunaris-dark'>
|
|
46
|
+
<view className='top-area' />
|
|
47
|
+
<view className='content-area'>
|
|
48
|
+
<Swiper
|
|
49
|
+
ref={swiperRef}
|
|
50
|
+
data={itemArr}
|
|
51
|
+
itemWidth={250}
|
|
52
|
+
duration={500}
|
|
53
|
+
initialIndex={0}
|
|
54
|
+
mode='normal'
|
|
55
|
+
modeConfig={{
|
|
56
|
+
align: 'center',
|
|
57
|
+
}}
|
|
58
|
+
onChange={setCurrentIndex}
|
|
59
|
+
main-thread:customAnimation={customAnimation}
|
|
60
|
+
customAnimationFirstScreen={customAnimationFirstScreen}
|
|
61
|
+
style={{
|
|
62
|
+
overflow: 'visible',
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
{({ index, realIndex }) => (
|
|
66
|
+
<SwiperItem index={index} key={realIndex} realIndex={realIndex}>
|
|
67
|
+
<Card
|
|
68
|
+
index={realIndex}
|
|
69
69
|
style={{
|
|
70
|
-
|
|
71
|
-
width: '4px',
|
|
72
|
-
height: '4px',
|
|
70
|
+
height: '250px',
|
|
73
71
|
}}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
/>
|
|
73
|
+
</SwiperItem>
|
|
74
|
+
)}
|
|
75
|
+
</Swiper>
|
|
76
|
+
<Indicator current={currentIndex} count={itemArr.length} />
|
|
77
|
+
</view>
|
|
78
|
+
<view className='demo-status'>
|
|
79
|
+
<text className='demo-status-text'>
|
|
80
|
+
Custom animation scales each slide around the active item.
|
|
81
|
+
</text>
|
|
82
|
+
</view>
|
|
81
83
|
</view>
|
|
82
84
|
)
|
|
83
85
|
}
|
package/CustomScale/index.tsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
|
|
5
|
-
import { root, useRef } from '@lynx-js/react'
|
|
5
|
+
import { root, useRef, useState } from '@lynx-js/react'
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
Swiper,
|
|
@@ -12,9 +12,12 @@ import {
|
|
|
12
12
|
} from '@lynx-js/lynx-ui'
|
|
13
13
|
import type { SwiperRef } from '@lynx-js/lynx-ui'
|
|
14
14
|
|
|
15
|
-
import '
|
|
15
|
+
import { Card } from '../Common/Card'
|
|
16
|
+
import { Indicator } from '../Common/Indicator'
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
import '../Common/Demo/styles.css'
|
|
19
|
+
|
|
20
|
+
const itemArr: number[] = [1, 2, 3, 4, 5]
|
|
18
21
|
|
|
19
22
|
const ITEM_WIDTH = 250
|
|
20
23
|
|
|
@@ -64,49 +67,48 @@ function customAnimationFirstScreen(value: number, _index: number) {
|
|
|
64
67
|
|
|
65
68
|
function SwiperEntry(): JSX.Element {
|
|
66
69
|
const swiperRef = useRef<SwiperRef>(null)
|
|
70
|
+
const [currentIndex, setCurrentIndex] = useState(0)
|
|
67
71
|
|
|
68
72
|
return (
|
|
69
|
-
<view
|
|
70
|
-
<
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
alignItems: 'center',
|
|
95
|
-
}}
|
|
96
|
-
>
|
|
97
|
-
<view
|
|
73
|
+
<view className='demo-container lunaris-dark'>
|
|
74
|
+
<view className='top-area' />
|
|
75
|
+
<view className='content-area'>
|
|
76
|
+
<Swiper
|
|
77
|
+
ref={swiperRef}
|
|
78
|
+
data={itemArr}
|
|
79
|
+
itemWidth={ITEM_WIDTH}
|
|
80
|
+
itemHeight={250}
|
|
81
|
+
duration={500}
|
|
82
|
+
initialIndex={0}
|
|
83
|
+
mode='custom'
|
|
84
|
+
modeConfig={{
|
|
85
|
+
align: 'center',
|
|
86
|
+
}}
|
|
87
|
+
onChange={setCurrentIndex}
|
|
88
|
+
main-thread:customAnimation={customAnimation}
|
|
89
|
+
customAnimationFirstScreen={customAnimationFirstScreen}
|
|
90
|
+
style={{
|
|
91
|
+
overflow: 'visible',
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
{({ index, realIndex }) => (
|
|
95
|
+
<SwiperItem index={index} key={realIndex} realIndex={realIndex}>
|
|
96
|
+
<Card
|
|
97
|
+
index={realIndex}
|
|
98
98
|
style={{
|
|
99
|
-
|
|
100
|
-
width: '4px',
|
|
101
|
-
height: '4px',
|
|
99
|
+
height: '250px',
|
|
102
100
|
}}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
101
|
+
/>
|
|
102
|
+
</SwiperItem>
|
|
103
|
+
)}
|
|
104
|
+
</Swiper>
|
|
105
|
+
<Indicator current={currentIndex} count={itemArr.length} />
|
|
106
|
+
</view>
|
|
107
|
+
<view className='demo-status'>
|
|
108
|
+
<text className='demo-status-text'>
|
|
109
|
+
Custom mode keeps the active slide centered while scaling neighbors.
|
|
110
|
+
</text>
|
|
111
|
+
</view>
|
|
110
112
|
</view>
|
|
111
113
|
)
|
|
112
114
|
}
|
|
@@ -2,32 +2,4 @@
|
|
|
2
2
|
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
3
|
// LICENSE file in the root directory of this source tree.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import { Button as ButtonInner } from '@lynx-js/lynx-ui'
|
|
7
|
-
|
|
8
|
-
const ButtonStyle = {
|
|
9
|
-
border: '1px solid',
|
|
10
|
-
'border-radius': '4px',
|
|
11
|
-
width: '150px',
|
|
12
|
-
'background-color': 'red',
|
|
13
|
-
margin: '4px 8px',
|
|
14
|
-
padding: '4px 8px',
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const ButtonTextStyle = {
|
|
18
|
-
color: 'white',
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export function Button(props: {
|
|
22
|
-
onClick: () => void
|
|
23
|
-
text: string
|
|
24
|
-
}) {
|
|
25
|
-
return (
|
|
26
|
-
<ButtonInner
|
|
27
|
-
style={ButtonStyle}
|
|
28
|
-
onClick={props.onClick}
|
|
29
|
-
>
|
|
30
|
-
<text style={ButtonTextStyle}>{props.text}</text>
|
|
31
|
-
</ButtonInner>
|
|
32
|
-
)
|
|
33
|
-
}
|
|
5
|
+
export { Button } from '../Common/Button'
|
package/Direction/index.tsx
CHANGED
|
@@ -6,118 +6,112 @@ import { root } from '@lynx-js/react'
|
|
|
6
6
|
|
|
7
7
|
import { Swiper, SwiperItem } from '@lynx-js/lynx-ui'
|
|
8
8
|
|
|
9
|
-
import '
|
|
9
|
+
import { Card } from '../Common/Card'
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
import '../Common/Demo/styles.css'
|
|
12
|
+
|
|
13
|
+
const itemArr: number[] = [1, 2, 3, 4]
|
|
14
|
+
|
|
15
|
+
function renderCard({
|
|
16
|
+
index,
|
|
17
|
+
realIndex,
|
|
18
|
+
}: {
|
|
19
|
+
index: number
|
|
20
|
+
realIndex: number
|
|
21
|
+
}) {
|
|
22
|
+
return (
|
|
23
|
+
<SwiperItem index={index} key={realIndex} realIndex={realIndex}>
|
|
24
|
+
<Card
|
|
25
|
+
index={realIndex}
|
|
26
|
+
style={{
|
|
27
|
+
height: '200px',
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
</SwiperItem>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
12
33
|
|
|
13
34
|
function SwiperEntry() {
|
|
14
35
|
return (
|
|
15
|
-
<scroll-view
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
<scroll-view
|
|
37
|
+
className='demo-scroll-container lunaris-dark'
|
|
38
|
+
scroll-orientation='vertical'
|
|
39
|
+
>
|
|
40
|
+
<view className='top-area' />
|
|
41
|
+
<view className='demo-section'>
|
|
42
|
+
<text className='demo-section-title'>Horizontal Swipe Only</text>
|
|
43
|
+
<text className='demo-section-description'>
|
|
44
|
+
Swiper stays horizontal while the parent scroll-view moves vertically.
|
|
45
|
+
</text>
|
|
18
46
|
</view>
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
41
|
-
}}
|
|
42
|
-
experimentalHorizontalSwipeOnly={true}
|
|
43
|
-
>
|
|
44
|
-
{({ item, index, realIndex }) => (
|
|
45
|
-
<SwiperItem index={index} key={realIndex} realIndex={realIndex}>
|
|
46
|
-
<view
|
|
47
|
-
class='block-view'
|
|
48
|
-
style={{
|
|
49
|
-
width: '100%',
|
|
50
|
-
height: '100%',
|
|
51
|
-
backgroundColor: item,
|
|
52
|
-
display: 'flex',
|
|
53
|
-
justifyContent: 'center',
|
|
54
|
-
alignItems: 'center',
|
|
55
|
-
}}
|
|
56
|
-
>
|
|
57
|
-
<view
|
|
58
|
-
style={{
|
|
59
|
-
backgroundColor: 'white',
|
|
60
|
-
width: '4px',
|
|
61
|
-
height: '4px',
|
|
62
|
-
}}
|
|
63
|
-
>
|
|
47
|
+
<view className='content-area content-area--compact'>
|
|
48
|
+
<Swiper
|
|
49
|
+
data={itemArr}
|
|
50
|
+
itemWidth={250}
|
|
51
|
+
itemHeight={200}
|
|
52
|
+
containerWidth={lynx.__globalProps.screenWidth - 32
|
|
53
|
+
|| SystemInfo.pixelWidth / SystemInfo.pixelRatio - 32}
|
|
54
|
+
loop={false}
|
|
55
|
+
duration={500}
|
|
56
|
+
initialIndex={0}
|
|
57
|
+
mode='normal'
|
|
58
|
+
modeConfig={{
|
|
59
|
+
align: 'start',
|
|
60
|
+
spaceBetween: 16,
|
|
61
|
+
}}
|
|
62
|
+
bounceConfig={{
|
|
63
|
+
enable: true,
|
|
64
|
+
startBounceItemWidth: 0,
|
|
65
|
+
endBounceItem: (
|
|
66
|
+
<view className='bounce-item'>
|
|
67
|
+
<text className='bounce-item-text'>End</text>
|
|
64
68
|
</view>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<view
|
|
98
|
-
class='block-view'
|
|
99
|
-
style={{
|
|
100
|
-
width: '100%',
|
|
101
|
-
height: '100%',
|
|
102
|
-
backgroundColor: item,
|
|
103
|
-
display: 'flex',
|
|
104
|
-
justifyContent: 'center',
|
|
105
|
-
alignItems: 'center',
|
|
106
|
-
}}
|
|
107
|
-
>
|
|
108
|
-
<view
|
|
109
|
-
style={{
|
|
110
|
-
backgroundColor: 'white',
|
|
111
|
-
width: '4px',
|
|
112
|
-
height: '4px',
|
|
113
|
-
}}
|
|
114
|
-
>
|
|
69
|
+
),
|
|
70
|
+
onEndBounceItemBounce: ({ type }) => {
|
|
71
|
+
console.log('onBounce result', type)
|
|
72
|
+
},
|
|
73
|
+
}}
|
|
74
|
+
experimentalHorizontalSwipeOnly={true}
|
|
75
|
+
style={{
|
|
76
|
+
overflow: 'visible',
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
{renderCard}
|
|
80
|
+
</Swiper>
|
|
81
|
+
<Swiper
|
|
82
|
+
data={itemArr}
|
|
83
|
+
itemWidth={250}
|
|
84
|
+
itemHeight={200}
|
|
85
|
+
containerWidth={lynx.__globalProps.screenWidth - 32
|
|
86
|
+
|| SystemInfo.pixelWidth / SystemInfo.pixelRatio - 32}
|
|
87
|
+
loop={false}
|
|
88
|
+
duration={500}
|
|
89
|
+
initialIndex={0}
|
|
90
|
+
mode='normal'
|
|
91
|
+
modeConfig={{
|
|
92
|
+
align: 'start',
|
|
93
|
+
spaceBetween: 16,
|
|
94
|
+
}}
|
|
95
|
+
bounceConfig={{
|
|
96
|
+
enable: true,
|
|
97
|
+
startBounceItemWidth: 0,
|
|
98
|
+
endBounceItem: (
|
|
99
|
+
<view className='bounce-item'>
|
|
100
|
+
<text className='bounce-item-text'>End</text>
|
|
115
101
|
</view>
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
102
|
+
),
|
|
103
|
+
onEndBounceItemBounce: ({ type }) => {
|
|
104
|
+
console.log('onBounce result', type)
|
|
105
|
+
},
|
|
106
|
+
}}
|
|
107
|
+
experimentalHorizontalSwipeOnly={true}
|
|
108
|
+
style={{
|
|
109
|
+
overflow: 'visible',
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
{renderCard}
|
|
113
|
+
</Swiper>
|
|
114
|
+
</view>
|
|
121
115
|
</scroll-view>
|
|
122
116
|
)
|
|
123
117
|
}
|
package/EmptyDataBug/index.tsx
CHANGED
|
@@ -22,6 +22,7 @@ import type { SwiperRef } from '@lynx-js/lynx-ui'
|
|
|
22
22
|
import { Button } from '../Common/Button'
|
|
23
23
|
import { Card } from '../Common/Card'
|
|
24
24
|
|
|
25
|
+
import '../Common/Demo/styles.css'
|
|
25
26
|
import './styles.css'
|
|
26
27
|
|
|
27
28
|
const DEFAULT_DATA: number[] = [1, 2, 3, 4, 5]
|
|
@@ -352,7 +353,7 @@ function ResetWithCorruptedIndex(): JSX.Element {
|
|
|
352
353
|
|
|
353
354
|
function EmptyDataBugExample(): JSX.Element {
|
|
354
355
|
return (
|
|
355
|
-
<scroll-view class='container' scroll-orientation='vertical'>
|
|
356
|
+
<scroll-view class='container lunaris-dark' scroll-orientation='vertical'>
|
|
356
357
|
<text class='main-title'>Empty Data Bug Reproduction</text>
|
|
357
358
|
<text class='main-description'>
|
|
358
359
|
These examples demonstrate the "calcBounceOffset: invalid offset" error
|
package/EmptyDataBug/styles.css
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
@import "@lynx-js/luna-styles/index.css";
|
|
2
|
+
|
|
1
3
|
.container {
|
|
4
|
+
background-color: var(--canvas);
|
|
2
5
|
width: 100%;
|
|
3
6
|
height: 100%;
|
|
4
7
|
padding: 16px;
|
|
@@ -7,14 +10,14 @@
|
|
|
7
10
|
|
|
8
11
|
.main-title {
|
|
9
12
|
font-size: 24px;
|
|
10
|
-
font-weight:
|
|
13
|
+
font-weight: 600;
|
|
11
14
|
margin-bottom: 8px;
|
|
12
|
-
color:
|
|
15
|
+
color: var(--content);
|
|
13
16
|
}
|
|
14
17
|
|
|
15
18
|
.main-description {
|
|
16
19
|
font-size: 14px;
|
|
17
|
-
color:
|
|
20
|
+
color: var(--content-muted);
|
|
18
21
|
margin-bottom: 24px;
|
|
19
22
|
line-height: 1.5;
|
|
20
23
|
}
|
|
@@ -22,20 +25,22 @@
|
|
|
22
25
|
.section {
|
|
23
26
|
margin-bottom: 32px;
|
|
24
27
|
padding: 16px;
|
|
25
|
-
background-color:
|
|
28
|
+
background-color: var(--neutral-ambient);
|
|
26
29
|
border-radius: 8px;
|
|
30
|
+
border-width: 1px;
|
|
31
|
+
border-color: var(--line);
|
|
27
32
|
}
|
|
28
33
|
|
|
29
34
|
.title {
|
|
30
35
|
font-size: 16px;
|
|
31
|
-
font-weight:
|
|
36
|
+
font-weight: 600;
|
|
32
37
|
margin-bottom: 8px;
|
|
33
|
-
color:
|
|
38
|
+
color: var(--content);
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
.description {
|
|
37
42
|
font-size: 12px;
|
|
38
|
-
color:
|
|
43
|
+
color: var(--content-muted);
|
|
39
44
|
margin-bottom: 16px;
|
|
40
45
|
line-height: 1.4;
|
|
41
46
|
}
|
|
@@ -53,23 +58,25 @@
|
|
|
53
58
|
gap: 4px;
|
|
54
59
|
margin-top: 12px;
|
|
55
60
|
padding: 8px;
|
|
56
|
-
background-color:
|
|
61
|
+
background-color: var(--canvas);
|
|
57
62
|
border-radius: 4px;
|
|
63
|
+
border-width: 1px;
|
|
64
|
+
border-color: var(--line);
|
|
58
65
|
}
|
|
59
66
|
|
|
60
67
|
.info text {
|
|
61
68
|
font-size: 12px;
|
|
62
|
-
color:
|
|
69
|
+
color: var(--content-muted);
|
|
63
70
|
}
|
|
64
71
|
|
|
65
72
|
.log-title {
|
|
66
|
-
font-weight:
|
|
73
|
+
font-weight: 600;
|
|
67
74
|
margin-top: 8px;
|
|
68
|
-
color:
|
|
75
|
+
color: var(--content);
|
|
69
76
|
}
|
|
70
77
|
|
|
71
78
|
.log-item {
|
|
72
79
|
font-size: 11px;
|
|
73
|
-
color:
|
|
80
|
+
color: var(--content-subtle);
|
|
74
81
|
padding-left: 8px;
|
|
75
82
|
}
|