@doubao-dev/taro-runtime 0.4.2 → 0.5.0
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/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @doubao-dev/taro-runtime
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
豆包应用插件的 Taro 运行时适配层,目前处于实验阶段。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
在 Taro 应用中安装:
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
```bash
|
|
7
|
+
```sh
|
|
10
8
|
pnpm add @doubao-dev/taro-runtime
|
|
11
9
|
```
|
|
10
|
+
|
|
11
|
+
然后按 [Taro 构建接入说明](../../taro-plugin/README.md#接入-taro-项目) 配置 Kit 的 `experiments.taro`。构建插件会将 `@tarojs/taro` 和 `@tarojs/components` 映射到本包,业务代码继续使用 Taro 的导入方式。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useContext, useEffect, useRef, useState } from '@byted-doubao-apps/framework';
|
|
2
|
-
import { warnUnsupported } from '../base/warn-unsupported.js';
|
|
3
2
|
import { RadioGroupRuntimeContext } from '../RadioGroup/context.js';
|
|
3
|
+
import { warnUnsupported } from '../base/warn-unsupported.js';
|
|
4
4
|
import { mapRadioProps, resolveLynxRadioValue, resolveStandaloneSelectedValue, shouldDispatchStandaloneRadioChange, toRadioChangeEvent } from './map.js';
|
|
5
5
|
import { markRuntimeRadio } from './shared.js';
|
|
6
6
|
function RadioImpl(props) {
|
|
@@ -60,7 +60,7 @@ function RadioImpl(props) {
|
|
|
60
60
|
const lynxStandaloneGroupProps = {
|
|
61
61
|
disabled: resolvedDisabled,
|
|
62
62
|
onValueChange: handleStandaloneSelect,
|
|
63
|
-
|
|
63
|
+
value: standaloneSelectedValue
|
|
64
64
|
};
|
|
65
65
|
return (<view {...mapped}>
|
|
66
66
|
<radio-group {...lynxStandaloneGroupProps}>
|
|
@@ -27,7 +27,7 @@ type MapRadioPropsResult = {
|
|
|
27
27
|
};
|
|
28
28
|
export declare function mapRadioProps(props: MappableTaroRadioProps): MapRadioPropsResult;
|
|
29
29
|
export declare function resolveLynxRadioValue(value: string | undefined, fallback: string): string;
|
|
30
|
-
export declare function resolveStandaloneSelectedValue(isChecked: boolean, value: string): string
|
|
30
|
+
export declare function resolveStandaloneSelectedValue(isChecked: boolean, value: string): string;
|
|
31
31
|
export declare function shouldDispatchStandaloneRadioChange(isChecked: boolean): boolean;
|
|
32
32
|
export declare function toRadioChangeEvent(detail: {
|
|
33
33
|
value?: string;
|
|
@@ -39,7 +39,8 @@ export function resolveLynxRadioValue(value, fallback) {
|
|
|
39
39
|
return value ?? fallback;
|
|
40
40
|
}
|
|
41
41
|
export function resolveStandaloneSelectedValue(isChecked, value) {
|
|
42
|
-
|
|
42
|
+
// Keep the inner group controlled with a value that cannot select this radio.
|
|
43
|
+
return isChecked ? value : `__taro_runtime_radio_unchecked_${value}`;
|
|
43
44
|
}
|
|
44
45
|
export function shouldDispatchStandaloneRadioChange(isChecked) {
|
|
45
46
|
return !isChecked;
|
package/package.json
CHANGED