@lynx-example/viewpager 0.0.0 → 0.6.12
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/LICENSE +0 -1
- package/dist/base.lynx.bundle +0 -0
- package/lynx.config.mjs +30 -0
- package/package.json +31 -5
- package/src/base/index.tsx +68 -0
- package/index.js +0 -1
package/LICENSE
CHANGED
|
Binary file
|
package/lynx.config.mjs
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
|
|
5
|
+
import { pluginQRCode } from "@lynx-js/qrcode-rsbuild-plugin";
|
|
6
|
+
import { pluginReactLynx } from "@lynx-js/react-rsbuild-plugin";
|
|
7
|
+
import { defineConfig } from "@lynx-js/rspeedy";
|
|
8
|
+
import { pluginSass } from "@rsbuild/plugin-sass";
|
|
9
|
+
import { pluginTypeCheck } from "@rsbuild/plugin-type-check";
|
|
10
|
+
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
source: {
|
|
13
|
+
entry: {
|
|
14
|
+
base: "./src/base/index.tsx",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
plugins: [
|
|
18
|
+
pluginReactLynx(),
|
|
19
|
+
pluginSass(),
|
|
20
|
+
pluginQRCode(),
|
|
21
|
+
pluginTypeCheck(),
|
|
22
|
+
],
|
|
23
|
+
output: {
|
|
24
|
+
assetPrefix: "https://lynxjs.org/lynx-examples/viewpager/dist",
|
|
25
|
+
filename: "[name].[platform].bundle",
|
|
26
|
+
},
|
|
27
|
+
environments: {
|
|
28
|
+
lynx: {},
|
|
29
|
+
},
|
|
30
|
+
});
|
package/package.json
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-example/viewpager",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"
|
|
3
|
+
"version": "0.6.12",
|
|
4
|
+
"description": "An example shows how to use `<viewpager>` in Lynx",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/lynx-family/lynx-examples.git",
|
|
8
|
+
"directory": "examples/viewpager"
|
|
9
|
+
},
|
|
6
10
|
"license": "Apache-2.0",
|
|
11
|
+
"author": "Lynx Authors",
|
|
7
12
|
"type": "module",
|
|
8
|
-
"
|
|
9
|
-
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/",
|
|
15
|
+
"src/",
|
|
16
|
+
"lynx.config.mjs"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@lynx-js/react": "0.117.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@lynx-js/qrcode-rsbuild-plugin": "0.4.6",
|
|
23
|
+
"@lynx-js/react-rsbuild-plugin": "0.13.0",
|
|
24
|
+
"@lynx-js/rspeedy": "0.13.6",
|
|
25
|
+
"@lynx-js/types": "3.7.0",
|
|
26
|
+
"@rsbuild/plugin-sass": "1.5.1",
|
|
27
|
+
"@types/react": "^18.3.28",
|
|
28
|
+
"typescript": "~5.9.3"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "rspeedy build",
|
|
32
|
+
"dev": "rspeedy dev",
|
|
33
|
+
"preview": "rspeedy preview"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
|
|
5
|
+
import { root, useState } from "@lynx-js/react";
|
|
6
|
+
|
|
7
|
+
const pages = [
|
|
8
|
+
{ title: "Page 1", color: "#FBE2E1" },
|
|
9
|
+
{ title: "Page 2", color: "#DCEEFF" },
|
|
10
|
+
{ title: "Page 3", color: "#E5F7DF" },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
const App = () => {
|
|
14
|
+
const [current, setCurrent] = useState<number>(0);
|
|
15
|
+
|
|
16
|
+
return (
|
|
17
|
+
<view
|
|
18
|
+
style={{
|
|
19
|
+
width: "100%",
|
|
20
|
+
height: "100%",
|
|
21
|
+
flexDirection: "column",
|
|
22
|
+
padding: "24px",
|
|
23
|
+
backgroundColor: "#FFFFFF",
|
|
24
|
+
boxSizing: "border-box",
|
|
25
|
+
}}
|
|
26
|
+
>
|
|
27
|
+
<text style={{ fontSize: "32px", fontWeight: "700", color: "#1F2329" }}>ViewPager Placeholder</text>
|
|
28
|
+
<text style={{ marginTop: "12px", fontSize: "24px", color: "#4E5969" }}>
|
|
29
|
+
{`Current page: ${current + 1}/${pages.length}`}
|
|
30
|
+
</text>
|
|
31
|
+
<view
|
|
32
|
+
style={{ marginTop: "24px", width: "100%", height: "50%", flex: 1, borderRadius: "24px", overflow: "hidden" }}
|
|
33
|
+
>
|
|
34
|
+
<viewpager
|
|
35
|
+
style={{ width: "100%", height: "100%", display: "flex", flexDirection: "row" }}
|
|
36
|
+
bindchange={(e) => {
|
|
37
|
+
setCurrent(e.detail.index);
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{pages.map((page) => {
|
|
41
|
+
return (
|
|
42
|
+
<viewpager-item style={{ width: "100%", height: "100%", flexShrink: 0 }}>
|
|
43
|
+
<view
|
|
44
|
+
key={page.title}
|
|
45
|
+
style={{
|
|
46
|
+
width: "100%",
|
|
47
|
+
height: "100%",
|
|
48
|
+
justifyContent: "center",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
backgroundColor: page.color,
|
|
51
|
+
}}
|
|
52
|
+
>
|
|
53
|
+
<text style={{ fontSize: "48px", fontWeight: "600", color: "#1F2329" }}>{page.title}</text>
|
|
54
|
+
</view>
|
|
55
|
+
</viewpager-item>
|
|
56
|
+
);
|
|
57
|
+
})}
|
|
58
|
+
</viewpager>
|
|
59
|
+
</view>
|
|
60
|
+
</view>
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
root.render(<App />);
|
|
65
|
+
|
|
66
|
+
if (import.meta.webpackHot) {
|
|
67
|
+
import.meta.webpackHot.accept();
|
|
68
|
+
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {}
|