@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
package/BasicDynamic/index.tsx
CHANGED
|
@@ -7,119 +7,111 @@ import { root, useEffect, useRef, useState } from '@lynx-js/react'
|
|
|
7
7
|
import { Swiper, SwiperItem } from '@lynx-js/lynx-ui'
|
|
8
8
|
import type { SwiperRef } from '@lynx-js/lynx-ui'
|
|
9
9
|
|
|
10
|
-
import './styles.css'
|
|
11
|
-
|
|
12
10
|
import { Button } from '../Common/Button'
|
|
11
|
+
import { Card } from '../Common/Card'
|
|
12
|
+
import { Indicator } from '../Common/Indicator'
|
|
13
|
+
|
|
14
|
+
import '../Common/Demo/styles.css'
|
|
13
15
|
|
|
14
|
-
const
|
|
15
|
-
'red',
|
|
16
|
-
'green',
|
|
17
|
-
'yellow',
|
|
18
|
-
'purple',
|
|
19
|
-
'lightgreen',
|
|
20
|
-
'lightyellow',
|
|
21
|
-
'lightblue',
|
|
22
|
-
'gray',
|
|
23
|
-
]
|
|
16
|
+
const DEFAULT_ITEM_ARR: number[] = [1, 2, 3, 4, 5, 6, 7, 8]
|
|
24
17
|
|
|
25
18
|
const itemWidths = [250, 350, 400]
|
|
26
19
|
const alignArr: ['start', 'center', 'end'] = ['start', 'center', 'end']
|
|
20
|
+
const INITIAL_INDEX = 0
|
|
27
21
|
|
|
28
22
|
function SwiperEntry(): JSX.Element {
|
|
29
23
|
const [itemWidthsIndex, setItemWidthsIndex] = useState<number>(0)
|
|
30
|
-
const [alignIndex, setAlignIndex] = useState<number>(
|
|
31
|
-
const [currentIndex, setCurrentIndex] = useState<number>(
|
|
24
|
+
const [alignIndex, setAlignIndex] = useState<number>(1)
|
|
25
|
+
const [currentIndex, setCurrentIndex] = useState<number>(INITIAL_INDEX)
|
|
32
26
|
const swiperRef = useRef<SwiperRef>(null)
|
|
33
|
-
const [
|
|
27
|
+
const [itemArr, setItemArr] = useState<number[]>([])
|
|
34
28
|
|
|
35
29
|
useEffect(() => {
|
|
36
30
|
setTimeout(() => {
|
|
37
|
-
|
|
31
|
+
setItemArr(DEFAULT_ITEM_ARR.slice(0, 4))
|
|
38
32
|
}, 1000)
|
|
39
33
|
}, [])
|
|
40
34
|
|
|
41
35
|
return (
|
|
42
|
-
<view
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
>
|
|
71
|
-
<view
|
|
36
|
+
<view className='demo-container lunaris-dark'>
|
|
37
|
+
<view className='top-area' />
|
|
38
|
+
<view className='content-area'>
|
|
39
|
+
<Swiper
|
|
40
|
+
ref={swiperRef}
|
|
41
|
+
data={itemArr}
|
|
42
|
+
itemWidth={itemWidths[itemWidthsIndex] ?? 0}
|
|
43
|
+
containerWidth={lynx.__globalProps.screenWidth - 32
|
|
44
|
+
|| SystemInfo.pixelWidth / SystemInfo.pixelRatio - 32}
|
|
45
|
+
itemHeight={250}
|
|
46
|
+
duration={500}
|
|
47
|
+
initialIndex={INITIAL_INDEX}
|
|
48
|
+
onChange={setCurrentIndex}
|
|
49
|
+
mode='normal'
|
|
50
|
+
loop={true}
|
|
51
|
+
autoPlay={true}
|
|
52
|
+
modeConfig={{
|
|
53
|
+
align: alignArr[alignIndex] ?? 'center',
|
|
54
|
+
spaceBetween: 16,
|
|
55
|
+
}}
|
|
56
|
+
style={{
|
|
57
|
+
overflow: 'visible',
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
{({ index, realIndex }) => (
|
|
61
|
+
<SwiperItem index={index} key={realIndex} realIndex={realIndex}>
|
|
62
|
+
<Card
|
|
63
|
+
index={realIndex}
|
|
72
64
|
style={{
|
|
73
|
-
|
|
74
|
-
width: '4px',
|
|
75
|
-
height: '4px',
|
|
65
|
+
height: '250px',
|
|
76
66
|
}}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
</view>
|
|
67
|
+
/>
|
|
68
|
+
</SwiperItem>
|
|
69
|
+
)}
|
|
70
|
+
</Swiper>
|
|
71
|
+
<Indicator
|
|
72
|
+
current={currentIndex}
|
|
73
|
+
count={itemArr.length}
|
|
74
|
+
/>
|
|
75
|
+
</view>
|
|
76
|
+
<view className='operation'>
|
|
88
77
|
<Button
|
|
89
78
|
onClick={() => {
|
|
90
79
|
swiperRef.current?.swipePrev()
|
|
91
80
|
}}
|
|
81
|
+
className='expand'
|
|
92
82
|
text='SwipePrev'
|
|
93
|
-
|
|
94
|
-
</Button>
|
|
83
|
+
/>
|
|
95
84
|
<Button
|
|
96
85
|
onClick={() => {
|
|
97
86
|
swiperRef.current?.swipeNext()
|
|
98
87
|
}}
|
|
88
|
+
className='expand'
|
|
89
|
+
type='primary'
|
|
99
90
|
text='SwipeNext'
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
/>
|
|
92
|
+
</view>
|
|
93
|
+
<view className='sub-operation'>
|
|
102
94
|
<Button
|
|
103
95
|
onClick={() => {
|
|
104
96
|
setItemWidthsIndex(prev => (prev + 1) % itemWidths.length)
|
|
105
97
|
}}
|
|
106
|
-
text=
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
text='Change Item Width'
|
|
99
|
+
subText={`ItemWidth: ${itemWidths[itemWidthsIndex]}`}
|
|
100
|
+
/>
|
|
109
101
|
<Button
|
|
110
102
|
onClick={() => {
|
|
111
103
|
setAlignIndex(prev => (prev + 1) % itemWidths.length)
|
|
112
104
|
}}
|
|
113
|
-
text=
|
|
114
|
-
|
|
115
|
-
|
|
105
|
+
text='Change Align Type'
|
|
106
|
+
subText={`AlignType: ${alignArr[alignIndex]}`}
|
|
107
|
+
/>
|
|
116
108
|
<Button
|
|
117
109
|
onClick={() => {
|
|
118
|
-
|
|
110
|
+
setItemArr(prev => DEFAULT_ITEM_ARR.slice(0, prev.length + 1))
|
|
119
111
|
}}
|
|
120
|
-
text=
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
text='Add List Item'
|
|
113
|
+
subText={`Current Length: ${itemArr.length}`}
|
|
114
|
+
/>
|
|
123
115
|
</view>
|
|
124
116
|
</view>
|
|
125
117
|
)
|
|
@@ -7,120 +7,110 @@ import { root, useEffect, useRef, useState } from '@lynx-js/react'
|
|
|
7
7
|
import { Swiper, SwiperItem } from '@lynx-js/lynx-ui'
|
|
8
8
|
import type { SwiperRef } from '@lynx-js/lynx-ui'
|
|
9
9
|
|
|
10
|
-
import './styles.css'
|
|
11
|
-
|
|
12
10
|
import { Button } from '../Common/Button'
|
|
11
|
+
import { Card } from '../Common/Card'
|
|
12
|
+
import { Indicator } from '../Common/Indicator'
|
|
13
|
+
|
|
14
|
+
import '../Common/Demo/styles.css'
|
|
13
15
|
|
|
14
|
-
const
|
|
15
|
-
'red',
|
|
16
|
-
'green',
|
|
17
|
-
'yellow',
|
|
18
|
-
'purple',
|
|
19
|
-
'lightgreen',
|
|
20
|
-
'lightyellow',
|
|
21
|
-
'lightblue',
|
|
22
|
-
'gray',
|
|
23
|
-
]
|
|
16
|
+
const DEFAULT_ITEM_ARR: number[] = [1, 2, 3, 4, 5, 6, 7, 8]
|
|
24
17
|
|
|
25
18
|
const itemWidths = [250, 350, 400]
|
|
26
19
|
const alignArr: ['start', 'center', 'end'] = ['start', 'center', 'end']
|
|
20
|
+
const INITIAL_INDEX = 0
|
|
27
21
|
|
|
28
22
|
function SwiperEntry(): JSX.Element {
|
|
29
23
|
const [itemWidthsIndex, setItemWidthsIndex] = useState<number>(0)
|
|
30
|
-
const [alignIndex, setAlignIndex] = useState<number>(
|
|
31
|
-
const [currentIndex, setCurrentIndex] = useState<number>(
|
|
24
|
+
const [alignIndex, setAlignIndex] = useState<number>(1)
|
|
25
|
+
const [currentIndex, setCurrentIndex] = useState<number>(INITIAL_INDEX)
|
|
32
26
|
const swiperRef = useRef<SwiperRef>(null)
|
|
33
|
-
const [
|
|
27
|
+
const [itemArr, setItemArr] = useState<number[]>([])
|
|
34
28
|
|
|
35
29
|
useEffect(() => {
|
|
36
30
|
setTimeout(() => {
|
|
37
|
-
|
|
31
|
+
setItemArr(DEFAULT_ITEM_ARR.slice(0, 4))
|
|
38
32
|
}, 1000)
|
|
39
33
|
}, [])
|
|
40
34
|
|
|
41
35
|
return (
|
|
42
|
-
<view
|
|
43
|
-
<
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
alignItems: 'center',
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
<view
|
|
36
|
+
<view className='demo-container lunaris-dark'>
|
|
37
|
+
<view className='top-area' />
|
|
38
|
+
<view className='content-area'>
|
|
39
|
+
<Swiper
|
|
40
|
+
ref={swiperRef}
|
|
41
|
+
data={itemArr}
|
|
42
|
+
itemWidth={itemWidths[itemWidthsIndex] ?? 0}
|
|
43
|
+
containerWidth={itemWidths[itemWidthsIndex] ?? 0}
|
|
44
|
+
itemHeight={250}
|
|
45
|
+
duration={500}
|
|
46
|
+
initialIndex={INITIAL_INDEX}
|
|
47
|
+
onChange={setCurrentIndex}
|
|
48
|
+
mode='normal'
|
|
49
|
+
loop={true}
|
|
50
|
+
autoPlay={false}
|
|
51
|
+
modeConfig={{
|
|
52
|
+
align: alignArr[alignIndex] ?? 'center',
|
|
53
|
+
spaceBetween: 16,
|
|
54
|
+
}}
|
|
55
|
+
style={{
|
|
56
|
+
overflow: 'visible',
|
|
57
|
+
}}
|
|
58
|
+
>
|
|
59
|
+
{({ index, realIndex }) => (
|
|
60
|
+
<SwiperItem index={index} key={realIndex} realIndex={realIndex}>
|
|
61
|
+
<Card
|
|
62
|
+
index={realIndex}
|
|
73
63
|
style={{
|
|
74
|
-
|
|
75
|
-
width: '4px',
|
|
76
|
-
height: '4px',
|
|
64
|
+
height: '250px',
|
|
77
65
|
}}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
</view>
|
|
66
|
+
/>
|
|
67
|
+
</SwiperItem>
|
|
68
|
+
)}
|
|
69
|
+
</Swiper>
|
|
70
|
+
<Indicator
|
|
71
|
+
current={currentIndex}
|
|
72
|
+
count={itemArr.length}
|
|
73
|
+
/>
|
|
74
|
+
</view>
|
|
75
|
+
<view className='operation'>
|
|
89
76
|
<Button
|
|
90
77
|
onClick={() => {
|
|
91
78
|
swiperRef.current?.swipePrev()
|
|
92
79
|
}}
|
|
80
|
+
className='expand'
|
|
93
81
|
text='SwipePrev'
|
|
94
|
-
|
|
95
|
-
</Button>
|
|
82
|
+
/>
|
|
96
83
|
<Button
|
|
97
84
|
onClick={() => {
|
|
98
85
|
swiperRef.current?.swipeNext()
|
|
99
86
|
}}
|
|
87
|
+
className='expand'
|
|
88
|
+
type='primary'
|
|
100
89
|
text='SwipeNext'
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
/>
|
|
91
|
+
</view>
|
|
92
|
+
<view className='sub-operation'>
|
|
103
93
|
<Button
|
|
104
94
|
onClick={() => {
|
|
105
95
|
setItemWidthsIndex(prev => (prev + 1) % itemWidths.length)
|
|
106
96
|
}}
|
|
107
|
-
text=
|
|
108
|
-
|
|
109
|
-
|
|
97
|
+
text='Update Container Width'
|
|
98
|
+
subText={`Width: ${itemWidths[itemWidthsIndex]}`}
|
|
99
|
+
/>
|
|
110
100
|
<Button
|
|
111
101
|
onClick={() => {
|
|
112
102
|
setAlignIndex(prev => (prev + 1) % itemWidths.length)
|
|
113
103
|
}}
|
|
114
|
-
text=
|
|
115
|
-
|
|
116
|
-
|
|
104
|
+
text='Change Align Type'
|
|
105
|
+
subText={`AlignType: ${alignArr[alignIndex]}`}
|
|
106
|
+
/>
|
|
117
107
|
<Button
|
|
118
108
|
onClick={() => {
|
|
119
|
-
|
|
109
|
+
setItemArr(prev => DEFAULT_ITEM_ARR.slice(0, prev.length + 1))
|
|
120
110
|
}}
|
|
121
|
-
text=
|
|
122
|
-
|
|
123
|
-
|
|
111
|
+
text='Add List Item'
|
|
112
|
+
subText={`Current Length: ${itemArr.length}`}
|
|
113
|
+
/>
|
|
124
114
|
</view>
|
|
125
115
|
</view>
|
|
126
116
|
)
|
package/Bounces/index.tsx
CHANGED
|
@@ -2,69 +2,85 @@
|
|
|
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 } from '@lynx-js/react'
|
|
5
|
+
import { root, useState } from '@lynx-js/react'
|
|
6
6
|
|
|
7
7
|
import { Swiper, SwiperItem } from '@lynx-js/lynx-ui'
|
|
8
8
|
|
|
9
|
+
import { Card } from '../Common/Card'
|
|
10
|
+
import { Indicator } from '../Common/Indicator'
|
|
11
|
+
|
|
12
|
+
import '../Common/Demo/styles.css'
|
|
9
13
|
import './styles.css'
|
|
10
14
|
|
|
11
|
-
const
|
|
15
|
+
const itemArr: number[] = [1, 2, 3, 4]
|
|
16
|
+
const CONTAINER_PADDING = 32
|
|
17
|
+
const BOUNCE_WIDTH = 96
|
|
18
|
+
const ITEM_GAP = 16
|
|
19
|
+
const ITEM_HEIGHT = 220
|
|
20
|
+
|
|
21
|
+
const getScreenWidth = () =>
|
|
22
|
+
lynx.__globalProps.screenWidth
|
|
23
|
+
|| SystemInfo.pixelWidth / SystemInfo.pixelRatio
|
|
12
24
|
|
|
13
25
|
function SwiperEntry() {
|
|
26
|
+
const [currentIndex, setCurrentIndex] = useState(0)
|
|
27
|
+
const containerWidth = getScreenWidth() - CONTAINER_PADDING
|
|
28
|
+
const itemWidth = Math.min(300, containerWidth - 48)
|
|
29
|
+
|
|
14
30
|
return (
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</
|
|
31
|
+
<view className='demo-container lunaris-dark'>
|
|
32
|
+
<view className='top-area' />
|
|
33
|
+
<view className='content-area bounces-content-area'>
|
|
34
|
+
<Swiper
|
|
35
|
+
data={itemArr}
|
|
36
|
+
itemWidth={itemWidth}
|
|
37
|
+
itemHeight={ITEM_HEIGHT}
|
|
38
|
+
containerWidth={containerWidth}
|
|
39
|
+
loop={false}
|
|
40
|
+
duration={500}
|
|
41
|
+
initialIndex={2}
|
|
42
|
+
mode='normal'
|
|
43
|
+
modeConfig={{
|
|
44
|
+
align: 'start',
|
|
45
|
+
spaceBetween: ITEM_GAP,
|
|
46
|
+
}}
|
|
47
|
+
style={{
|
|
48
|
+
overflow: 'hidden',
|
|
49
|
+
}}
|
|
50
|
+
bounceConfig={{
|
|
51
|
+
enable: true,
|
|
52
|
+
startBounceItemWidth: 0,
|
|
53
|
+
endBounceItemWidth: BOUNCE_WIDTH,
|
|
54
|
+
endBounceItem: (
|
|
55
|
+
<view className='bounce-loading'>
|
|
56
|
+
<view className='bounce-loading-dot bounce-loading-dot--first' />
|
|
57
|
+
<view className='bounce-loading-dot bounce-loading-dot--second' />
|
|
58
|
+
<view className='bounce-loading-dot bounce-loading-dot--third' />
|
|
59
|
+
</view>
|
|
60
|
+
),
|
|
61
|
+
onEndBounceItemBounce: ({ type }) => {
|
|
62
|
+
console.log('onBounce result', type)
|
|
63
|
+
},
|
|
64
|
+
}}
|
|
65
|
+
onChange={setCurrentIndex}
|
|
66
|
+
>
|
|
67
|
+
{({ index, realIndex }) => (
|
|
68
|
+
<SwiperItem index={index} key={realIndex} realIndex={realIndex}>
|
|
69
|
+
<Card
|
|
70
|
+
index={realIndex}
|
|
71
|
+
style={{
|
|
72
|
+
height: `${ITEM_HEIGHT}px`,
|
|
73
|
+
}}
|
|
74
|
+
/>
|
|
75
|
+
</SwiperItem>
|
|
76
|
+
)}
|
|
77
|
+
</Swiper>
|
|
78
|
+
<Indicator
|
|
79
|
+
current={currentIndex}
|
|
80
|
+
count={itemArr.length}
|
|
81
|
+
/>
|
|
82
|
+
</view>
|
|
83
|
+
</view>
|
|
68
84
|
)
|
|
69
85
|
}
|
|
70
86
|
|
package/Bounces/styles.css
CHANGED
|
@@ -1,41 +1,50 @@
|
|
|
1
|
-
.
|
|
2
|
-
width: 100%;
|
|
3
|
-
height: 100%;
|
|
4
|
-
}
|
|
1
|
+
@import "@lynx-js/luna-styles/index.css";
|
|
5
2
|
|
|
6
|
-
.
|
|
7
|
-
|
|
3
|
+
.bounces-content-area {
|
|
4
|
+
padding-top: 80px;
|
|
5
|
+
padding-bottom: 36px;
|
|
8
6
|
}
|
|
9
7
|
|
|
10
|
-
.
|
|
11
|
-
|
|
8
|
+
.bounce-loading {
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 96px;
|
|
12
11
|
height: 100%;
|
|
12
|
+
flex-direction: row;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: flex-start;
|
|
15
|
+
padding-left: 18px;
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
.bounce-loading-dot {
|
|
19
|
+
width: 8px;
|
|
20
|
+
height: 8px;
|
|
21
|
+
margin-right: 6px;
|
|
22
|
+
border-radius: 50%;
|
|
23
|
+
background-color: var(--gradient-content);
|
|
24
|
+
animation: bounce-loading-pulse 900ms ease-in-out infinite;
|
|
18
25
|
}
|
|
19
26
|
|
|
20
|
-
.
|
|
21
|
-
|
|
27
|
+
.bounce-loading-dot--second {
|
|
28
|
+
animation-delay: 150ms;
|
|
22
29
|
}
|
|
23
30
|
|
|
24
|
-
.
|
|
25
|
-
|
|
26
|
-
border-radius: 4px;
|
|
27
|
-
width: 150px;
|
|
28
|
-
background-color: red;
|
|
29
|
-
margin: 4px 8px;
|
|
30
|
-
padding: 4px 8px;
|
|
31
|
+
.bounce-loading-dot--third {
|
|
32
|
+
animation-delay: 300ms;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
@keyframes bounce-loading-pulse {
|
|
36
|
+
0% {
|
|
37
|
+
opacity: 0.3;
|
|
38
|
+
transform: scale(0.75);
|
|
39
|
+
}
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
50% {
|
|
42
|
+
opacity: 1;
|
|
43
|
+
transform: scale(1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
100% {
|
|
47
|
+
opacity: 0.3;
|
|
48
|
+
transform: scale(0.75);
|
|
49
|
+
}
|
|
41
50
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @lynx-example/lynx-ui-swiper
|
|
2
2
|
|
|
3
|
+
## 0.0.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Update swiper examples to match luna theme ([#150](https://github.com/lynx-family/lynx-ui/pull/150))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @lynx-js/lynx-ui@3.131.1
|
|
11
|
+
|
|
12
|
+
## 0.0.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies [[`c476c26`](https://github.com/lynx-family/lynx-ui/commit/c476c268e42c5116745c1c5be96556714532bdab), [`1778e64`](https://github.com/lynx-family/lynx-ui/commit/1778e644dc0910766d86c1422237c1341e8c726c)]:
|
|
17
|
+
- @lynx-js/lynx-ui@3.131.0
|
|
18
|
+
|
|
3
19
|
## 0.0.3
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|