@react-native-ohos/slider 5.1.2-rc.1 → 5.1.2-rc.2

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +187 -183
  2. package/COMMITTERS.md +5 -5
  3. package/LICENSE +8 -8
  4. package/OAT.xml +72 -72
  5. package/README.OpenSource +10 -10
  6. package/README.md +12 -12
  7. package/babel.config.json +3 -3
  8. package/dist/Slider.js +1 -1
  9. package/dist/components/StepNumber.js +1 -1
  10. package/dist/components/StepsIndicator.js +1 -1
  11. package/dist/components/TrackMark.js +1 -1
  12. package/dist/utils/styles.js +1 -1
  13. package/example/.eslintrc +18 -18
  14. package/example/.node-version +6 -6
  15. package/example/.prettierrc.js +7 -7
  16. package/example/.watchmanconfig +5 -5
  17. package/example/app.json +3 -3
  18. package/example/babel.config.js +9 -9
  19. package/example/contexts.ts +9 -9
  20. package/example/harmony/AppScope/app.json5 +10 -10
  21. package/example/harmony/AppScope/resources/base/element/string.json +8 -8
  22. package/example/harmony/build-profile.template.json5 +35 -35
  23. package/example/harmony/codelinter.json +32 -32
  24. package/example/harmony/entry/build-profile.json5 +21 -21
  25. package/example/harmony/entry/hvigorfile.ts +8 -8
  26. package/example/harmony/entry/oh-package.json5 +10 -10
  27. package/example/harmony/entry/src/main/cpp/CMakeLists.txt +41 -41
  28. package/example/harmony/entry/src/main/cpp/PackageProvider.cpp +16 -16
  29. package/example/harmony/entry/src/main/ets/RNPackagesFactory.ets +13 -13
  30. package/example/harmony/entry/src/main/ets/entryability/EntryAbility.ets +27 -27
  31. package/example/harmony/entry/src/main/ets/pages/Index.ets +125 -125
  32. package/example/harmony/entry/src/main/ets/pages/SurfaceDeadlockTest.ets +135 -135
  33. package/example/harmony/entry/src/main/ets/pages/TouchDisplayer.ets +43 -43
  34. package/example/harmony/entry/src/main/module.json5 +51 -51
  35. package/example/harmony/entry/src/main/resources/base/element/color.json +7 -7
  36. package/example/harmony/entry/src/main/resources/base/element/string.json +15 -15
  37. package/example/harmony/entry/src/main/resources/base/profile/main_pages.json +5 -5
  38. package/example/harmony/format.ps1 +17 -17
  39. package/example/harmony/hvigor/hvigor-config.json5 +20 -20
  40. package/example/harmony/hvigorfile.ts +8 -8
  41. package/example/harmony/oh-package.json5 +11 -11
  42. package/example/index.js +10 -10
  43. package/example/jest.config.js +11 -11
  44. package/example/metro.config.js +30 -30
  45. package/example/package.json +58 -58
  46. package/example/react-native.config.js +11 -11
  47. package/example/scripts/create-build-profile.js +45 -45
  48. package/example/src/index.tsx +22 -22
  49. package/example/tsconfig.json +19 -19
  50. package/harmony/slider/oh-package.json5 +10 -10
  51. package/harmony/slider.har +0 -0
  52. package/package.json +92 -92
  53. package/react-native.config.js +11 -11
  54. package/src/RNCSliderNativeComponent.ts +51 -51
  55. package/src/Slider.tsx +356 -356
  56. package/src/components/StepNumber.tsx +23 -23
  57. package/src/components/StepsIndicator.tsx +89 -89
  58. package/src/components/TrackMark.tsx +59 -59
  59. package/src/index.ts +9 -9
  60. package/src/utils/constants.ts +17 -17
  61. package/src/utils/styles.ts +61 -61
  62. package/tsconfig.json +23 -23
  63. package/typings/index.d.ts +214 -214
  64. package/.github/Examples/Slider-Android-Example.gif +0 -0
  65. package/.github/Examples/Slider-Web-Example.gif +0 -0
  66. package/.github/Examples/Slider-Windows-Example.gif +0 -0
  67. package/.github/Examples/Slider-iOS-Example.gif +0 -0
  68. package/.github/ISSUE_TEMPLATE/BUG_REPORT.md +0 -38
  69. package/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +0 -14
  70. package/.github/ISSUE_TEMPLATE/QUESTION.md +0 -9
  71. package/.github/PULL_REQUEST_TEMPLATE.md +0 -11
  72. package/.github/workflows/ReactNativeSlider-CI.yml +0 -231
  73. package/harmony/slider/README.OpenSource +0 -11
@@ -1,46 +1,46 @@
1
- /*
2
- * Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
3
- * Use of this source code is governed by a MIT license that can be
4
- * found in the LICENSE file.
5
- */
6
-
7
-
8
- const fs = require('fs');
9
- const JSON5 = require('json5');
10
- const path = require('path');
11
-
12
- const templatePath = path.join(
13
- __dirname,
14
- '..',
15
- 'harmony',
16
- 'build-profile.template.json5',
17
- );
18
- const existingProfilePath = path.join(
19
- __dirname,
20
- '..',
21
- 'harmony',
22
- 'build-profile.json5',
23
- );
24
-
25
- if (fs.existsSync(existingProfilePath)) {
26
- let existingProfile = JSON5.parse(
27
- fs.readFileSync(existingProfilePath, 'utf-8'),
28
- );
29
- let template = JSON5.parse(fs.readFileSync(templatePath, 'utf-8'));
30
- let signingConfigs =
31
- existingProfile.app && existingProfile.app.signingConfigs;
32
-
33
- existingProfile = {...template};
34
-
35
- if (signingConfigs) {
36
- existingProfile.app.signingConfigs = signingConfigs;
37
- }
38
-
39
- fs.writeFileSync(
40
- existingProfilePath,
41
- JSON5.stringify(existingProfile, null, 2),
42
- );
43
- } else {
44
- // File doesn't exist, create a copy from the template
45
- fs.copyFileSync(templatePath, existingProfilePath);
1
+ /*
2
+ * Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+
8
+ const fs = require('fs');
9
+ const JSON5 = require('json5');
10
+ const path = require('path');
11
+
12
+ const templatePath = path.join(
13
+ __dirname,
14
+ '..',
15
+ 'harmony',
16
+ 'build-profile.template.json5',
17
+ );
18
+ const existingProfilePath = path.join(
19
+ __dirname,
20
+ '..',
21
+ 'harmony',
22
+ 'build-profile.json5',
23
+ );
24
+
25
+ if (fs.existsSync(existingProfilePath)) {
26
+ let existingProfile = JSON5.parse(
27
+ fs.readFileSync(existingProfilePath, 'utf-8'),
28
+ );
29
+ let template = JSON5.parse(fs.readFileSync(templatePath, 'utf-8'));
30
+ let signingConfigs =
31
+ existingProfile.app && existingProfile.app.signingConfigs;
32
+
33
+ existingProfile = {...template};
34
+
35
+ if (signingConfigs) {
36
+ existingProfile.app.signingConfigs = signingConfigs;
37
+ }
38
+
39
+ fs.writeFileSync(
40
+ existingProfilePath,
41
+ JSON5.stringify(existingProfile, null, 2),
42
+ );
43
+ } else {
44
+ // File doesn't exist, create a copy from the template
45
+ fs.copyFileSync(templatePath, existingProfilePath);
46
46
  }
@@ -1,22 +1,22 @@
1
- /*
2
- * Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
3
- * Use of this source code is governed by a MIT license that can be
4
- * found in the LICENSE file.
5
- */
6
-
7
- import Slider from "@react-native-community/slider"
8
- import { View } from 'react-native'
9
-
10
- export default function SliderExample() {
11
- return (
12
- <View style={{ backgroundColor: 'red', width: 200, height: 100 ,margin:100 }}>
13
- <Slider
14
- style={{ width: 200, height: 40 }}
15
- minimumValue={0}
16
- maximumValue={1}
17
- minimumTrackTintColor="#FFFFFF"
18
- maximumTrackTintColor="#000000"
19
- />
20
- </View>
21
- );
22
- };
1
+ /*
2
+ * Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ import Slider from "@react-native-community/slider"
8
+ import { View } from 'react-native'
9
+
10
+ export default function SliderExample() {
11
+ return (
12
+ <View style={{ backgroundColor: 'red', width: 200, height: 100 ,margin:100 }}>
13
+ <Slider
14
+ style={{ width: 200, height: 40 }}
15
+ minimumValue={0}
16
+ maximumValue={1}
17
+ minimumTrackTintColor="#FFFFFF"
18
+ maximumTrackTintColor="#000000"
19
+ />
20
+ </View>
21
+ );
22
+ };
@@ -1,20 +1,20 @@
1
- /*
2
- * Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
3
- * Use of this source code is governed by a MIT license that can be
4
- * found in the LICENSE file.
5
- */
6
-
7
- {
8
- "extends": "@react-native/typescript-config/tsconfig.json",
9
- "compilerOptions": {
10
- "jsx": "react-native",
11
- "paths": {
12
- "react-native": [
13
- "./node_modules/react-native-harmony"
14
- ],
15
- },
16
- },
17
- "exclude": [
18
- "harmony"
19
- ]
1
+ /*
2
+ * Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ {
8
+ "extends": "@react-native/typescript-config/tsconfig.json",
9
+ "compilerOptions": {
10
+ "jsx": "react-native",
11
+ "paths": {
12
+ "react-native": [
13
+ "./node_modules/react-native-harmony"
14
+ ],
15
+ },
16
+ },
17
+ "exclude": [
18
+ "harmony"
19
+ ]
20
20
  }
@@ -1,11 +1,11 @@
1
- {
2
- "name": "@react-native-ohos/slider",
3
- "version": "5.1.2-rc.1",
4
- "description": "@react-native-community/slider for HarmonyOS",
5
- "main": "index.ets",
6
- "author": "Huawei",
7
- "license": "MIT",
8
- "dependencies": {
9
- "@rnoh/react-native-openharmony": "file:../react_native_openharmony.har"
10
- }
1
+ {
2
+ "name": "@react-native-ohos/slider",
3
+ "version": "5.1.2-rc.2",
4
+ "description": "@react-native-community/slider for HarmonyOS",
5
+ "main": "index.ets",
6
+ "author": "Huawei",
7
+ "license": "MIT",
8
+ "dependencies": {
9
+ "@rnoh/react-native-openharmony": "file:../react_native_openharmony.har"
10
+ }
11
11
  }
Binary file
package/package.json CHANGED
@@ -1,92 +1,92 @@
1
- {
2
- "name": "@react-native-ohos/slider",
3
- "version": "5.1.2-rc.1",
4
- "license": "MIT",
5
- "author": "react-native-community",
6
- "homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-slider/tree/br_rnoh0.77#readme",
7
- "description": "React Native component used to select a single value from a range of values.",
8
- "harmony": {
9
- "alias": "@react-native-community/slider"
10
- },
11
- "publishConfig": {
12
- "registry": "https://npm.pkg.github.com"
13
- },
14
- "main": "dist/Slider.js",
15
- "types": "typings/index.d.ts",
16
- "keywords": [
17
- "react-native",
18
- "react native",
19
- "slider"
20
- ],
21
- "scripts": {
22
- "prepare": "babel --extensions \".ts,.tsx\" --out-dir dist src",
23
- "lint": "npx eslint src",
24
- "test": "npx jest src"
25
- },
26
- "dependencies": {
27
- "@react-native-community/slider": "5.1.1"
28
- },
29
- "devDependencies": {
30
- "@babel/cli": "^7.8.4",
31
- "@babel/core": "^7.25.2",
32
- "@babel/preset-flow": "^7.9.0",
33
- "@babel/preset-typescript": "^7.18.6",
34
- "@babel/runtime": "^7.25.0",
35
- "@react-native-community/cli": "^20.0.2",
36
- "@react-native-community/cli-platform-android": "^20.0.2",
37
- "@react-native-community/cli-platform-ios": "^20.0.2",
38
- "@react-native-community/eslint-config": "^3.2.0",
39
- "@react-native/babel-preset": "^0.81.1",
40
- "@react-native/eslint-config": "^0.81.1",
41
- "@react-native/metro-config": "^0.81.1",
42
- "@react-native/typescript-config": "^0.81.1",
43
- "@types/jest": "^28.1.8",
44
- "@types/react": "^19.2.0",
45
- "@types/react-test-renderer": "^19.1.0",
46
- "babel-jest": "^29.7.0",
47
- "babel-plugin-module-resolver": "5.0.0",
48
- "copyfiles": "^2.4.1",
49
- "eslint": "^8.19.0",
50
- "eslint-plugin-prettier": "4.2.1",
51
- "eslint-plugin-react": "^7.30.1",
52
- "eslint-plugin-react-native": "^4.0.0",
53
- "flow-bin": "^0.163.0",
54
- "jest": "^29.5.0",
55
- "prettier": "2.8.8",
56
- "react": "^19.2.0",
57
- "react-native": "^0.81.4",
58
- "react-native-windows": "^0.76.2",
59
- "react-test-renderer": "^19.2.0",
60
- "typescript": "^5.0.4"
61
- },
62
- "repository": {
63
- "type": "git",
64
- "url": "https://gitcode.com/openharmony-sig/rntpc_react-native-slider.git"
65
- },
66
- "jest": {
67
- "preset": "react-native",
68
- "verbose": true,
69
- "modulePathIgnorePatterns": [
70
- "/e2e/"
71
- ]
72
- },
73
- "prettier": {
74
- "singleQuote": true,
75
- "trailingComma": "all",
76
- "bracketSpacing": false,
77
- "jsxBracketSameLine": true
78
- },
79
- "codegenConfig": {
80
- "name": "RNCSlider",
81
- "type": "components",
82
- "jsSrcsDir": "src",
83
- "android": {
84
- "javaPackageName": "com.reactnativecommunity.slider"
85
- },
86
- "ios": {
87
- "componentProvider": {
88
- "RNCSlider": "RNCSliderComponentView"
89
- }
90
- }
91
- }
92
- }
1
+ {
2
+ "name": "@react-native-ohos/slider",
3
+ "version": "5.1.2-rc.2",
4
+ "license": "MIT",
5
+ "author": "react-native-community",
6
+ "homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-slider/tree/br_rnoh0.77#readme",
7
+ "description": "React Native component used to select a single value from a range of values.",
8
+ "harmony": {
9
+ "alias": "@react-native-community/slider"
10
+ },
11
+ "publishConfig": {
12
+ "registry": "https://npm.pkg.github.com"
13
+ },
14
+ "main": "dist/Slider.js",
15
+ "types": "typings/index.d.ts",
16
+ "keywords": [
17
+ "react-native",
18
+ "react native",
19
+ "slider"
20
+ ],
21
+ "scripts": {
22
+ "prepare": "babel --extensions \".ts,.tsx\" --out-dir dist src",
23
+ "lint": "npx eslint src",
24
+ "test": "npx jest src"
25
+ },
26
+ "dependencies": {
27
+ "@react-native-community/slider": "5.1.1"
28
+ },
29
+ "devDependencies": {
30
+ "@babel/cli": "^7.8.4",
31
+ "@babel/core": "^7.25.2",
32
+ "@babel/preset-flow": "^7.9.0",
33
+ "@babel/preset-typescript": "^7.18.6",
34
+ "@babel/runtime": "^7.25.0",
35
+ "@react-native-community/cli": "^20.0.2",
36
+ "@react-native-community/cli-platform-android": "^20.0.2",
37
+ "@react-native-community/cli-platform-ios": "^20.0.2",
38
+ "@react-native-community/eslint-config": "^3.2.0",
39
+ "@react-native/babel-preset": "^0.81.1",
40
+ "@react-native/eslint-config": "^0.81.1",
41
+ "@react-native/metro-config": "^0.81.1",
42
+ "@react-native/typescript-config": "^0.81.1",
43
+ "@types/jest": "^28.1.8",
44
+ "@types/react": "^19.2.0",
45
+ "@types/react-test-renderer": "^19.1.0",
46
+ "babel-jest": "^29.7.0",
47
+ "babel-plugin-module-resolver": "5.0.0",
48
+ "copyfiles": "^2.4.1",
49
+ "eslint": "^8.19.0",
50
+ "eslint-plugin-prettier": "4.2.1",
51
+ "eslint-plugin-react": "^7.30.1",
52
+ "eslint-plugin-react-native": "^4.0.0",
53
+ "flow-bin": "^0.163.0",
54
+ "jest": "^29.5.0",
55
+ "prettier": "2.8.8",
56
+ "react": "^19.2.0",
57
+ "react-native": "^0.81.4",
58
+ "react-native-windows": "^0.76.2",
59
+ "react-test-renderer": "^19.2.0",
60
+ "typescript": "^5.0.4"
61
+ },
62
+ "repository": {
63
+ "type": "git",
64
+ "url": "https://gitcode.com/openharmony-sig/rntpc_react-native-slider.git"
65
+ },
66
+ "jest": {
67
+ "preset": "react-native",
68
+ "verbose": true,
69
+ "modulePathIgnorePatterns": [
70
+ "/e2e/"
71
+ ]
72
+ },
73
+ "prettier": {
74
+ "singleQuote": true,
75
+ "trailingComma": "all",
76
+ "bracketSpacing": false,
77
+ "jsxBracketSameLine": true
78
+ },
79
+ "codegenConfig": {
80
+ "name": "RNCSlider",
81
+ "type": "components",
82
+ "jsSrcsDir": "src",
83
+ "android": {
84
+ "javaPackageName": "com.reactnativecommunity.slider"
85
+ },
86
+ "ios": {
87
+ "componentProvider": {
88
+ "RNCSlider": "RNCSliderComponentView"
89
+ }
90
+ }
91
+ }
92
+ }
@@ -1,11 +1,11 @@
1
- module.exports = {
2
- dependency: {
3
- platforms: {
4
- android: {
5
- libraryName: 'RNCSlider',
6
- componentDescriptors: ['RNCSliderComponentDescriptor'],
7
- cmakeListsPath: 'src/main/jni/CMakeLists.txt',
8
- },
9
- },
10
- },
11
- };
1
+ module.exports = {
2
+ dependency: {
3
+ platforms: {
4
+ android: {
5
+ libraryName: 'RNCSlider',
6
+ componentDescriptors: ['RNCSliderComponentDescriptor'],
7
+ cmakeListsPath: 'src/main/jni/CMakeLists.txt',
8
+ },
9
+ },
10
+ },
11
+ };
@@ -1,51 +1,51 @@
1
- /*
2
- * Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
3
- * Use of this source code is governed by a MIT license that can be
4
- * found in the LICENSE file.
5
- */
6
-
7
- import type {ColorValue, HostComponent, ViewProps} from 'react-native';
8
- import {ImageSource, codegenNativeComponent} from 'react-native';
9
- import type {
10
- Float,
11
- WithDefault,
12
- DirectEventHandler,
13
- BubblingEventHandler,
14
- Double,
15
- } from 'react-native/Libraries/Types/CodegenTypes';
16
-
17
- type Event = Readonly<{
18
- value: Float;
19
- fromUser?: boolean;
20
- }>;
21
-
22
- export interface NativeProps extends ViewProps {
23
- accessibilityUnits?: string;
24
- accessibilityIncrements?: ReadonlyArray<string>;
25
- disabled?: WithDefault<boolean, false>;
26
- inverted?: WithDefault<boolean, false>;
27
- vertical?: WithDefault<boolean, false>;
28
- tapToSeek?: WithDefault<boolean, false>;
29
- maximumTrackImage?: ImageSource;
30
- maximumTrackTintColor?: ColorValue;
31
- maximumValue?: Double;
32
- minimumTrackImage?: ImageSource;
33
- minimumTrackTintColor?: ColorValue;
34
- minimumValue?: Double;
35
- onChange?: BubblingEventHandler<Event>;
36
- onRNCSliderSlidingStart?: DirectEventHandler<Event>;
37
- onRNCSliderSlidingComplete?: DirectEventHandler<Event>;
38
- onRNCSliderValueChange?: BubblingEventHandler<Event>;
39
- step?: Double;
40
- testID?: string;
41
- thumbImage?: ImageSource;
42
- thumbTintColor?: ColorValue;
43
- trackImage?: ImageSource;
44
- value?: Float;
45
- lowerLimit?: Float;
46
- upperLimit?: Float;
47
- }
48
-
49
- export default codegenNativeComponent<NativeProps>('RNCSlider', {
50
- interfaceOnly: true,
51
- }) as HostComponent<NativeProps>;
1
+ /*
2
+ * Copyright (c) 2025 Huawei Device Co., Ltd. All rights reserved
3
+ * Use of this source code is governed by a MIT license that can be
4
+ * found in the LICENSE file.
5
+ */
6
+
7
+ import type {ColorValue, HostComponent, ViewProps} from 'react-native';
8
+ import {ImageSource, codegenNativeComponent} from 'react-native';
9
+ import type {
10
+ Float,
11
+ WithDefault,
12
+ DirectEventHandler,
13
+ BubblingEventHandler,
14
+ Double,
15
+ } from 'react-native/Libraries/Types/CodegenTypes';
16
+
17
+ type Event = Readonly<{
18
+ value: Float;
19
+ fromUser?: boolean;
20
+ }>;
21
+
22
+ export interface NativeProps extends ViewProps {
23
+ accessibilityUnits?: string;
24
+ accessibilityIncrements?: ReadonlyArray<string>;
25
+ disabled?: WithDefault<boolean, false>;
26
+ inverted?: WithDefault<boolean, false>;
27
+ vertical?: WithDefault<boolean, false>;
28
+ tapToSeek?: WithDefault<boolean, false>;
29
+ maximumTrackImage?: ImageSource;
30
+ maximumTrackTintColor?: ColorValue;
31
+ maximumValue?: Double;
32
+ minimumTrackImage?: ImageSource;
33
+ minimumTrackTintColor?: ColorValue;
34
+ minimumValue?: Double;
35
+ onChange?: BubblingEventHandler<Event>;
36
+ onRNCSliderSlidingStart?: DirectEventHandler<Event>;
37
+ onRNCSliderSlidingComplete?: DirectEventHandler<Event>;
38
+ onRNCSliderValueChange?: BubblingEventHandler<Event>;
39
+ step?: Double;
40
+ testID?: string;
41
+ thumbImage?: ImageSource;
42
+ thumbTintColor?: ColorValue;
43
+ trackImage?: ImageSource;
44
+ value?: Float;
45
+ lowerLimit?: Float;
46
+ upperLimit?: Float;
47
+ }
48
+
49
+ export default codegenNativeComponent<NativeProps>('RNCSlider', {
50
+ interfaceOnly: true,
51
+ }) as HostComponent<NativeProps>;