Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/packages/signature/signature.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const InternalSignature: ForwardRefRenderFunction<
const initCanvas = () => {
nextTick(() => {
setTimeout(() => {
if (getEnv() === 'WEAPP' || getEnv() === 'JD') {
if (['WEAPP', 'JD', 'ASCF'].includes(getEnv())) {
createSelectorQuery()
.select(`#${canvasId}`)
.fields(
Expand Down Expand Up @@ -186,7 +186,7 @@ const InternalSignature: ForwardRefRenderFunction<
return (
<View className={`${classPrefix} ${className}`} {...rest}>
<View className={`${classPrefix}-inner spcanvas_WEAPP`} ref={wrapRef}>
{getEnv() === 'WEAPP' || getEnv() === 'JD' ? (
{['WEAPP', 'JD', 'ASCF'].includes(getEnv()) ? (
<canvas
id={canvasId}
ref={canvasRef}
Expand Down
2 changes: 1 addition & 1 deletion src/packages/uploader/uploader.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const InternalUploader: ForwardRefRenderFunction<
document.body.appendChild(obj)
}
}
if (['WEAPP', 'JD', 'WEB'].includes(env) && chooseMedia) {
if (['WEAPP', 'JD', 'WEB', 'ASCF'].includes(env) && chooseMedia) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

Taro chooseMedia API ASCF Harmony support documentation

💡 Result:

Taro.chooseMedia is supported on Harmony (including Harmony hybrid) but the Taro docs do not list ASCF 元服务 support for chooseMedia. (docs.taro.zone)

Citations:


🌐 Web query:

Taro chooseMedia supported platforms environments

💡 Result:

Short answer — where Taro's chooseMedia works (and where it doesn't):

  • Supported on standard mini-program platforms compiled by Taro: WeChat, Alipay, Baidu, ByteDance/抖音 (TT), QQ, JD (i.e. the built-in Taro platform plugins). [1]
  • On WeChat specifically, chooseMedia is the native API (wx.chooseMedia) and is supported in modern base-libraries / clients. [3]
  • H5: you must use web-file input / custom implementation when targeting H5 (Taro compiles to web but there is no direct native chooseMedia). [1]
  • React Native / some native targets (Taro RN / Harmony RN builds) — chooseMedia (and related camera/video APIs) are listed as currently unsupported or platform-limited in Taro’s RN/Harmony notes; you’ll need a native module or platform-specific code. [2]

If you want, I can list exact Taro plugin names and links or show a small code example with platform guards.


ASCF environment does not have documented support for Taro's chooseMedia API.

According to Taro's official documentation, chooseMedia is supported on standard mini-program platforms (WeChat, Alipay, Baidu, ByteDance, QQ, JD) and Harmony (including Harmony hybrid), but ASCF (Harmony Yuan Service) is not listed as a supported platform for this API. Adding ASCF to the environment check on line 156 may result in a runtime error when chooseMedia is called in the ASCF environment.

Consider whether ASCF should use a fallback API (such as chooseImage or chooseVideo) instead, or if this change requires additional native support or compatibility handling for the ASCF runtime.

🤖 Prompt for AI Agents
In src/packages/uploader/uploader.taro.tsx around line 156, the environment
check includes 'ASCF' in the list of platforms assumed to support
Taro.chooseMedia, but ASCF does not document support for that API; remove 'ASCF'
from the includes list and implement an explicit fallback for ASCF (e.g., when
env === 'ASCF' use chooseImage/chooseVideo or other supported APIs) or add a
feature-detection wrapper that calls chooseMedia only when available and
otherwise routes to the fallback, ensuring any calls to chooseMedia are guarded
to avoid runtime errors.

chooseMedia({
count: multiple ? (maxCount as number) * 1 - fileList.length : 1,
/** 文件类型 */
Expand Down