{"id":191005,"date":"2023-07-02T21:44:32","date_gmt":"2023-07-02T13:44:32","guid":{"rendered":"https:\/\/www.idc.net\/help\/191005\/"},"modified":"2023-07-02T21:44:32","modified_gmt":"2023-07-02T13:44:32","slug":"%e5%90%8e%e6%b5%aa%e4%ba%91react%e6%95%99%e7%a8%8b%ef%bc%9a%e8%be%85%e5%8a%a9%e5%8a%9f%e8%83%bd","status":"publish","type":"post","link":"https:\/\/idc.net\/help\/191005\/","title":{"rendered":"\u540e\u6d6a\u4e91React\u6559\u7a0b\uff1a\u8f85\u52a9\u529f\u80fd"},"content":{"rendered":"<h2>iOS<\/h2>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728 iOS \u7cfb\u7edf\u4e0a\u8f85\u52a9\u529f\u80fd\u6db5\u76d6\u8bb8\u591a\u8bdd\u9898\uff0c\u4f46\u5bf9\u8bb8\u591a\u4eba\u6765\u8bf4\u8f85\u52a9\u529f\u80fd\u662f VoiceOver \u7684\u4ee3\u540d\u8bcd\uff0c\u5373 iOS 3.0 \u7248\u672c\u4ee5\u540e\u7684\u4e00\u79cd\u6280\u672f\u3002\u5b83\u5145\u5f53\u5c4f\u5e55\u9605\u8bfb\u5668\u7684\u89d2\u8272\uff0c\u5141\u8bb8\u6709\u89c6\u89c9\u969c\u788d\u7684\u4eba\u4f7f\u7528 iOS \u8bbe\u5907\u3002\u70b9\u51fb\u8fd9\u91cc\u4e86\u89e3\u66f4\u591a\u3002<\/p>\n<h2>Android<\/h2>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5bf9 Android \u7cfb\u7edf\u800c\u8a00\uff0c\u8f85\u52a9\u529f\u80fd\u6d89\u53ca\u5230\u4e86\u8bb8\u591a\u4e0d\u540c\u7684\u8bdd\u9898\uff0c\u5176\u4e2d\u4e4b\u4e00\u662f\u8ba9\u4e27\u5931\u89c6\u529b\u7684\u4eba\u80fd\u591f\u4f7f\u7528\u60a8\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u5bf9\u4e8e\u73b0\u5728\u7684\u793e\u4f1a\uff0c\u8c37\u6b4c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u540d\u53eb TalkBack \u7684\u5185\u7f6e\u5c4f\u5e55\u8bfb\u8005\u670d\u52a1\u673a\u5668\u4eba\u3002\u4f7f\u7528\u8be5\u673a\u5668\u4eba\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u89e6\u6478\u52d8\u63a2\u548c\u624b\u52bf\u6765\u4f7f\u7528\u79fb\u52a8\u8bbe\u5907\u548c\u5e94\u7528\u7a0b\u5e8f\u3002TalkBack \u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u8bed\u97f3\u8f6c\u6362\u5668\u6765\u9605\u8bfb\u5c4f\u5e55\u4e0a\u7684\u5185\u5bb9\u5e76\u4e14\u53ef\u4ee5\u53d1\u51fa\u8b66\u62a5\u6765\u901a\u77e5\u7528\u6237\u6709\u5173\u4e8e\u5e94\u7528\u7a0b\u5e8f\u4e2d\u7684\u91cd\u8981\u4fe1\u606f\u3002\u70b9\u51fb\u8fd9\u91cc\u6765\u4e86\u89e3\u66f4\u591a\u5173\u4e8e Android \u7684\u8f85\u52a9\u529f\u80fd\u7684\u7279\u5f81\u4ee5\u53ca\u70b9\u51fb\u8fd9\u91cc\u6765\u4e86\u89e3\u66f4\u591a\u5173\u4e8e\u4f7f\u60a8\u7684\u672c\u5730\u5e94\u7528\u7a0b\u5e8f\u7684\u8f85\u52a9\u529f\u80fd\u3002<\/p>\n<h2>\u521b\u5efa\u8f85\u52a9\u6027\u5e94\u7528\u7a0b\u5e8f<\/h2>\n<h3>\u8f85\u52a9\u529f\u80fd\u7684\u6027\u8d28<\/h3>\n<h4>\u8f85\u52a9\u6027\uff08iOS, Android\uff09<\/h4>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5982\u679c\u4e3a<span>&nbsp;<\/span><code>true<\/code>\u7684\u60c5\u51b5\uff0c\u4ee3\u8868\u8be5\u89c6\u56fe\u662f\u4e00\u4e2a\u8f85\u52a9\u529f\u80fd\u5143\u7d20\u3002\u5f53\u89c6\u56fe\u662f\u8f85\u52a9\u529f\u80fd\u5143\u7d20\u65f6\uff0c\u5b83\u628a\u5b83\u7684\u5b50\u5143\u7d20\u5206\u7ec4\u6210\u4e00\u4e2a\u5355\u4e00\u7684\u53ef\u9009\u7ec4\u4ef6\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ef\u89e6\u6478\u7684\u6240\u6709\u5143\u7d20\u90fd\u5177\u6709\u8f85\u52a9\u6027\u3002<\/p>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728 Android \u7cfb\u7edf\u4e2d\uff0c\u5728 react-native \u89c6\u56fe\u4e2d ' accessible={true}' \u5c5e\u6027\u5c06\u88ab\u7ffb\u8bd1\u6210\u672c\u5730\u547d\u4ee4 ' focusable={true}'\u3002<\/p>\n<pre>&lt;View&nbsp;accessible={true}&gt;\n&nbsp;&nbsp;&lt;Text&gt;text&nbsp;one&lt;\/Text&gt;\n&nbsp;&nbsp;&lt;Text&nbsp;&gt;text&nbsp;two&lt;\/Text&gt;\n&lt;\/View&gt;<\/pre>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u6211\u4eec\u4e0d\u80fd\u5206\u522b\u5728 'text one' \u548c 'text two' \u4e2d\u83b7\u5f97\u8f85\u52a9\u7126\u70b9\u3002\u76f8\u53cd\u6211\u4eec\u53ef\u4ee5\u5728\u7236\u5143\u7d20\u4e0a\u4f7f\u7528 'accessible' \u5c5e\u6027\u83b7\u5f97\u7126\u70b9\u3002<\/p>\n<h4>accessibilityLabel (iOS, Android)<\/h4>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5982\u679c\u8981\u5c06\u89c6\u56fe\u6807\u8bb0\u4e3a\u5177\u6709\u8f85\u52a9\u6027\uff0c\u90a3\u4e48\u4e00\u4e2a\u6bd4\u8f83\u597d\u7684\u505a\u6cd5\u5c31\u662f\u4e3a\u8fd9\u4e2a\u89c6\u56fe\u8bbe\u7f6e\u4e00\u4e2a accessibilityLabel \u6807\u7b7e\u4ee5\u4fbf\u4f7f\u7528 VoiceOver \u7684\u4eba\u77e5\u9053\u4ed6\u4eec\u9009\u62e9\u4e86\u4ec0\u4e48\u5143\u7d20\u3002\u5f53\u7528\u6237\u9009\u62e9\u4e86\u4e00\u4e9b\u5143\u7d20\uff0c\u90a3\u4e48 VoiceOver \u5c06\u4f1a\u9605\u8bfb\u54cd\u5e94\u7684\u5b57\u7b26\u4e32\u6587\u672c\u3002<\/p>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u82e5\u8981\u4f7f\u7528\u5b83\uff0c\u5728\u60a8\u7684\u89c6\u56fe\u4e2d\u5c06&nbsp;<code>accessibilityLabel<\/code>&nbsp;\u5c5e\u6027\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u5b57\u7b26\u4e32\uff1a<\/p>\n<pre>&lt;TouchableOpacity&nbsp;accessible={true}&nbsp;accessibilityLabel={'Tap&nbsp;me!'}&nbsp;onPress={this._onPress}&gt;\n&nbsp;&nbsp;&lt;View&nbsp;style={styles.button}&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;Text&nbsp;style={styles.buttonText}&gt;Press&nbsp;me!&lt;\/Text&gt;\n&nbsp;&nbsp;&lt;\/View&gt;\n&lt;\/TouchableOpacity&gt;<\/pre>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0cTouchableOpacity \u5143\u7d20\u4e2d\u7684&nbsp;<code>accessibilityLabel<\/code>&nbsp;\u4f1a\u88ab\u9ed8\u8ba4\u7684\u8bbe\u7f6e\u4e3a \"\u70b9\u51fb\u6211\uff01\"\u3002 \u8be5\u6807\u7b7e\u662f\u901a\u8fc7\u4f7f\u7528\u7a7a\u683c\u7b26\u6765\u4e32\u8054\u6240\u6709\u6587\u672c\u8282\u70b9\u5b50\u5143\u7d20\u6784\u9020\u7684\u3002<\/p>\n<h4>accessibilityTraits (iOS)<\/h4>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u8f85\u52a9\u529f\u80fd\u7279\u5f81\u544a\u8bc9\u4eba\u4eec\u4ed6\u4eec\u5728\u4f7f\u7528 VoiceOver \u7684\u65f6\u5019\u9009\u62e9\u4e86\u4ec0\u4e48\u5143\u7d20\u3002\u6b64\u5143\u7d20\u662f\u4e00\u4e2a\u6807\u7b7e\uff1f\u4e00\u4e2a\u6309\u94ae\uff1f\u8fd8\u662f\u6807\u5934\uff1f<code>accessibilityTraits<\/code>&nbsp;\u5c06\u4f1a\u56de\u7b54\u8fd9\u4e9b\u95ee\u9898\u3002<\/p>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5982\u679c\u8981\u4f7f\u7528\u5b83\uff0c\u8bf7\u628a accessibilityTraits \u5c5e\u6027\u8bbe\u7f6e\u4e3a accessibilityTraits \u8f85\u52a9\u529f\u80fd\u5b57\u7b26\u4e32(\u6216\u6570\u7ec4)\u4e4b\u4e00\uff1a<\/p>\n<ul>\n<li>\n<p><strong>none<\/strong>&nbsp;\u5f53\u5143\u7d20\u6ca1\u6709\u7279\u5f81\u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>button<\/strong>&nbsp;\u5f53\u5143\u7d20\u9700\u8981\u88ab\u5f53\u505a\u4e00\u4e2a\u6309\u94ae\u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>link<\/strong>&nbsp;\u5f53\u5143\u7d20\u9700\u8981\u88ab\u5f53\u505a\u94fe\u63a5\u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>header<\/strong>&nbsp;\u5f53\u5143\u7d20\u4f5c\u4e3a\u5185\u5bb9\u90e8\u5206\u7684\u6807\u9898 (\u5982\u5bfc\u822a\u680f\u4e2d\u7684\u6807\u9898) \u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>search<\/strong>&nbsp;\u5f53\u6587\u672c\u5b57\u6bb5\u5143\u7d20\u4e5f\u88ab\u89c6\u4e3a\u4e00\u4e2a\u641c\u7d22\u5b57\u6bb5\u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>image<\/strong>&nbsp;\u5f53\u5143\u7d20\u9700\u8981\u88ab\u4f5c\u4e3a\u56fe\u50cf\uff0c\u6bd4\u5982\u548c\u6309\u94ae\u548c\u94fe\u63a5\u7ed3\u5408\u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>selected<\/strong>&nbsp;\u5f53\u8be5\u5143\u7d20\u88ab\u9009\u4e2d\u65f6\u4f7f\u7528\u3002\u4f8b\u5982\uff0c\u8868\u4e2d\u88ab\u9009\u4e2d\u7684\u884c\u6216\u8005\u5206\u6bb5\u63a7\u4ef6\u4e2d\u9009\u4e2d\u7684\u6309\u94ae\u3002<\/p>\n<\/li>\n<li>\n<p><strong>plays<\/strong>&nbsp;\u5f53\u5143\u7d20\u88ab\u6fc0\u6d3b\u7684\u5e76\u4e14\u64ad\u653e\u81ea\u5df1\u7684\u58f0\u97f3\u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>key<\/strong>&nbsp;\u5f53\u5143\u7d20\u5145\u5f53\u952e\u76d8\u6309\u952e\u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>text<\/strong>&nbsp;\u5f53\u5143\u7d20\u5e94\u8be5\u88ab\u89c6\u4e3a\u4e0d\u80fd\u66f4\u6539\u7684\u9759\u6001\u6587\u672c\u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>summary<\/strong>&nbsp;\u5f53\u5728\u5e94\u7528\u7a0b\u5e8f\u9996\u6b21\u542f\u52a8\u7684\u65f6\u5019\uff0c\u8be5\u5143\u7d20\u53ef\u4ee5\u63d0\u4f9b\u5e94\u7528\u7a0b\u5e8f\u7684\u5b9e\u65f6\u72b6\u51b5\u7684\u6458\u8981\u7684\u65f6\u5019\u4f7f\u7528\u3002\u4f8b\u5982\uff0c\u5f53\u5173\u4e8e\u5929\u6c14\u7684\u5e94\u7528\u7a0b\u5e8f\u9996\u6b21\u542f\u52a8\u7684\u65f6\u5019\uff0c\u5e26\u6709\u5f53\u5929\u5929\u6c14\u4fe1\u606f\u7684\u5143\u7d20\u5c06\u88ab\u8be5\u7279\u5f81\u6240\u6807\u8bb0\u3002<\/p>\n<\/li>\n<li>\n<p><strong>disabled<\/strong>&nbsp;\u5f53\u63a7\u4ef6\u672a\u542f\u52a8\u5e76\u4e14\u5bf9\u7528\u6237\u7684\u8f93\u5165\u65e0\u54cd\u5e94\u7684\u65f6\u5019\u4f7f\u7528\u3002<\/p>\n<\/li>\n<li>\n<p><strong>frequentUpdates<\/strong>&nbsp;\u5f53\u5143\u7d20\u7ecf\u5e38\u66f4\u65b0\u5176\u6807\u7b7e\u6216\u8005\u5b83\u7684\u503c\uff0c\u4f46\u662f\u592a\u5e73\u51e1\u7684\u53d1\u9001\u901a\u77e5\u7684\u65f6\u5019\u4f7f\u7528\u3002\u5141\u8bb8\u8f85\u52a9\u529f\u80fd\u5ba2\u6237\u7aef\u8f6e\u8be2\u66f4\u6539\u3002\u79d2\u8868\u5c31\u662f\u4e00\u4e2a\u4f8b\u5b50\u3002<\/p>\n<\/li>\n<li>\n<p><strong>startsMedia<\/strong>&nbsp;\u5f53\u6fc0\u6d3b\u4e00\u4e2a\u5143\u7d20\u5e76\u5f00\u59cb\u4e00\u6bb5\u5a92\u4f53\u4f1a\u8bdd(\u4f8b\u5982\u64ad\u653e\u7535\u5f71\uff0c\u5f55\u5236\u97f3\u9891)\u4e0d\u5e94\u8be5\u88ab\u8f85\u52a9\u6280\u672f\u7684\u8f93\u51fa\u6240\u6253\u65ad\uff0c\u6bd4\u5982 VoiceOver\u3002<\/p>\n<\/li>\n<li>\n<p><strong>adjustable<\/strong>&nbsp;\u5f53\u5143\u7d20\u53ef\u4ee5\u88ab\"\u8c03\u6574\"\u7684\u65f6\u5019\u4f7f\u7528(\u4f8b\u5982\u6ed1\u5757)\u3002<\/p>\n<\/li>\n<li>\n<p><strong>allowsDirectInteraction<\/strong>&nbsp;\u5f53\u5143\u7d20\u5141\u8bb8 VoiceOver \u7528\u6237\u76f4\u63a5\u8fdb\u884c\u89e6\u6478\u4e92\u52a8\u7684\u65f6\u5019\u4f7f\u7528(\u4f8b\u5982\uff0c\u8868\u793a\u4e00\u4e2a\u94a2\u7434\u952e\u76d8\u7684\u89c6\u56fe)\u3002<\/p>\n<\/li>\n<li>\n<p><strong>pageTurn<\/strong>&nbsp;\u5f53\u5b83\u5b8c\u6210\u9605\u8bfb\u7684\u5143\u7d20\u7684\u5185\u5bb9\u65f6\u5019\u901a\u77e5 VoiceOver \u9700\u8981\u6eda\u52a8\u5230\u4e0b\u4e00\u4e2a\u9875\u9762\u3002<\/p>\n<\/li>\n<\/ul>\n<h4>onAccessibilityTap (iOS)<\/h4>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u4f7f\u7528\u6b64\u5c5e\u6027\u6765\u5206\u914d\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u51fd\u6570\uff0c\u5f53\u6709\u4eba\u5728\u4e00\u4e2a\u53ef\u8bbf\u95ee\u5143\u7d20\u88ab\u9009\u4e2d\u7684\u65f6\u5019\u901a\u8fc7\u53cc\u51fb\u6765\u6fc0\u6d3b\u5b83\u7684\u65f6\u5019\u6765\u8c03\u7528\u8be5\u51fd\u6570\u3002<\/p>\n<h4>onMagicTap (iOS)<\/h4>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5f53\u6709\u4eba\u4f7f\u7528 \u201cmagic tap\u201d\u624b\u52bf\uff0c\u5373\uff1a\u7528\u4e24\u4e2a\u624b\u6307\u53cc\u51fb\u7684\u65f6\u5019\uff0c\u8be5\u5c5e\u6027\u5c31\u4f1a\u88ab\u5206\u914d\u7ed9\u4e00\u4e2a\u81ea\u5b9a\u4e49\u51fd\u6570\uff0c\u540c\u65f6\uff0c\u8fd9\u4e2a\u51fd\u6570\u4f1a\u88ab\u8c03\u7528\u3002\u4e00\u4e2a\u9b54\u6cd5\u6572\u51fb\u51fd\u6570\u5e94\u8be5\u6267\u884c\u7528\u6237\u53ef\u4ee5\u5728\u7ec4\u4ef6\u4e2d\u627e\u5230\u7684\u6700\u5177\u6709\u76f8\u5173\u6027\u7684\u64cd\u4f5c\u3002\u5728 iPhone \u7684\u624b\u673a\u5e94\u7528\u7a0b\u5e8f\u4e2d\uff0c\u4e00\u4e2a\u9b54\u6cd5\u6572\u51fb\u53ef\u4ee5\u63a5\u542c\u6216\u8005\u7ed3\u675f\u4e00\u4e2a\u7535\u8bdd\u3002\u5982\u679c\u6240\u9009\u7684\u5143\u7d20\u4e0d\u5177\u6709&nbsp;<code>onMagicTap<\/code>&nbsp;\u529f\u80fd\uff0c\u8be5\u7cfb\u7edf\u5c06\u904d\u5386\u89c6\u56fe\u5c42\u6b21\u7ed3\u6784\u76f4\u5230\u5b83\u627e\u5230\u4e00\u4e2a\u62e5\u6709\u6b64\u529f\u80fd\u7684\u89c6\u56fe\u3002<\/p>\n<h4>accessibilityComponentType (Android)<\/h4>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u4e5f\u8981\u63d0\u9192\u9009\u5b9a\u7684\u7ec4\u4ef6\u7c7b\u578b\u7684\u6700\u7ec8\u7528\u6237 (\u5373\uff0c\u5b83\u662f\u4e00\u4e2a\"\u6309\u94ae\")\u3002\u5982\u679c\u6211\u4eec\u6b63\u5728\u4f7f\u7528\u672c\u673a\u7684\u6309\u94ae\uff0c\u90a3\u4e48\u5b83\u4f1a\u81ea\u52a8\u5de5\u4f5c\u3002\u7531\u4e8e\u6211\u4eec\u4f7f\u7528\u7684\u662f javascript\uff0c\u6240\u4ee5\u6211\u4eec\u9700\u8981\u4e3a TalkBack \u63d0\u4f9b\u66f4\u591a\u7684\u8bed\u5883\u3002\u4e3a\u4e86\u8fbe\u5230\u8fd9\u4e2a\u76ee\u7684\uff0c\u60a8\u5fc5\u987b\u4e3a\u6240\u6709 UI \u7ec4\u4ef6\u6307\u5b9a 'accessibilityComponentType' \u5c5e\u6027\u3002\u4f8b\u5982\uff0c\u6211\u4eec\u652f\u6301 'button'\uff0c'radiobutton_checked' \u548c 'radiobutton_unchecked'\u7b49\u3002<\/p>\n<pre>&lt;TouchableWithoutFeedback&nbsp;accessibilityComponentType=\u201dbutton\u201d\n&nbsp;&nbsp;onPress={this._onPress}&gt;\n&nbsp;&nbsp;&lt;View&nbsp;style={styles.button}&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;Text&nbsp;style={styles.buttonText}&gt;Press&nbsp;me!&lt;\/Text&gt;\n&nbsp;&nbsp;&lt;\/View&gt;\n&lt;\/TouchableWithoutFeedback&gt;<\/pre>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0cTouchableWithoutFeedback \u662f\u88ab TalkBack \u4f5c\u4e3a\u4e00\u4e2a\u672c\u673a\u6309\u94ae\u58f0\u660e\u7684\u3002<\/p>\n<h4>accessibilityLiveRegion (Android)<\/h4>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5f53\u7ec4\u4ef6\u52a8\u6001\u7684\u66f4\u6539\u65f6\uff0c\u6211\u4eec\u5e0c\u671b TalkBack \u53bb\u63d0\u9192\u6700\u7ec8\u7528\u6237\u3002'AccessibilityLiveRegion' \u5c5e\u6027\u8ba9\u8fd9\u6210\u4e3a\u53ef\u80fd\u3002\u5b83\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a \u2018none\u2019, \u2018polite\u2019 \u4ee5\u53ca \u2018assertive\u2019\u3002<\/p>\n<ul>\n<li>\n<p><strong>none<\/strong>&nbsp;\u8f85\u52a9\u529f\u80fd\u670d\u52a1\u4e0d\u5e94\u8be5\u5bf9\u6b64\u89c6\u56fe\u901a\u77e5\u6539\u53d8\u7684\u5730\u65b9\u3002<\/p>\n<\/li>\n<li>\n<p><strong>polite<\/strong>&nbsp;\u8f85\u52a9\u529f\u80fd\u670d\u52a1\u5e94\u8be5\u5bf9\u6b64\u89c6\u56fe\u901a\u77e5\u6539\u53d8\u7684\u5730\u65b9\u3002<\/p>\n<\/li>\n<li>\n<p><strong>assertive<\/strong>&nbsp;\u8f85\u52a9\u529f\u80fd\u670d\u52a1\u5e94\u8be5\u4e2d\u65ad\u6b63\u5728\u8fdb\u884c\u7684\u4f1a\u8bdd\uff0c\u5e76\u4e14\u4ee5\u7acb\u5373\u5ba3\u5e03\u8be5\u89c6\u56fe\u7684\u6539\u53d8\u3002<\/p>\n<\/li>\n<\/ul>\n<pre>&lt;TouchableWithoutFeedback&nbsp;onPress={this._addOne}&gt;\n&nbsp;&nbsp;&lt;View&nbsp;style={styles.embedded}&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;Text&gt;Click&nbsp;me&lt;\/Text&gt;\n&nbsp;&nbsp;&lt;\/View&gt;\n&lt;\/TouchableWithoutFeedback&gt;\n&lt;Text&nbsp;accessibilityLiveRegion=\"polite\"&gt;\n&nbsp;&nbsp;Clicked&nbsp;{this.state.count}&nbsp;times\n&lt;\/Text&gt;<\/pre>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u65b9\u6cd5 _addOne \u66f4\u6539\u4e86 state.count \u53d8\u91cf\u3002\u5f53\u6700\u7ec8\u7528\u6237\u5355\u51fb TouchableWithoutFeedback \u7684\u65f6\u5019\uff0c\u56e0\u4e3a TalkBack \u7684 'accessibilityLiveRegion=\u201dpolite\u201d' \u5c5e\u6027\uff0c\u6240\u4ee5\u5b83\u8bfb\u53d6\u4e86\u6587\u672c\u89c6\u56fe\u4e2d\u7684\u6587\u672c\u3002<\/p>\n<h4>importantForAccessibility (Android)<\/h4>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5bf9\u4e8e\u4e24\u4e2a\u91cd\u53e0\u7684\u5e76\u4e14\u62e5\u6709\u76f8\u540c\u7236\u5143\u7d20\u7684 UI \u7ec4\u4ef6\uff0c\u9ed8\u8ba4\u7684\u8f85\u52a9\u529f\u80fd\u7126\u70b9\u53ef\u4ee5\u6709\u4e0d\u53ef\u9884\u77e5\u7684\u884c\u4e3a\u3002\u5982\u679c\u4e00\u4e2a\u89c6\u56fe\u89e6\u53d1\u8f85\u52a9\u4e8b\u4ef6\u5e76\u4e14\u5b83\u88ab\u6c47\u62a5\u7ed9\u4e86\u8f85\u52a9\u529f\u80fd\u670d\u52a1\u5668\uff0c\u90a3\u4e48 'ImportantForAccessibility' \u5c5e\u6027\u5c06\u4f1a\u901a\u8fc7\u63a7\u5236\u89e3\u51b3\u5b83\uff0c\u5b83\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u2018auto\u2019, \u2018yes\u2019, \u2018no\u2019 \u4ee5\u53ca \u2018no-hide-descendants\u2019 (\u6700\u540e\u4e00\u4e2a\u503c\u5c06\u8feb\u4f7f\u8f85\u52a9\u529f\u80fd\u670d\u52a1\u5ffd\u7565\u8be5\u7ec4\u4ef6\u548c\u5b83\u7684\u6240\u6709\u5b50\u5143\u7d20)\u3002<\/p>\n<pre>&lt;View&nbsp;style={styles.container}&gt;\n&nbsp;&nbsp;&lt;View&nbsp;style={{position:&nbsp;'absolute',&nbsp;left:&nbsp;10,&nbsp;top:&nbsp;10,&nbsp;right:&nbsp;10,&nbsp;height:&nbsp;100,\n&nbsp;&nbsp;&nbsp;&nbsp;backgroundColor:&nbsp;'green'}}&nbsp;importantForAccessibility=\u201dyes\u201d&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;Text&gt;&nbsp;First&nbsp;layout&nbsp;&lt;\/Text&gt;\n&nbsp;&nbsp;&lt;\/View&gt;\n&nbsp;&nbsp;&lt;View&nbsp;style={{position:&nbsp;'absolute',&nbsp;left:&nbsp;10,&nbsp;top:&nbsp;10,&nbsp;right:&nbsp;10,&nbsp;height:&nbsp;100,\n&nbsp;&nbsp;&nbsp;&nbsp;backgroundColor:&nbsp;'yellow'}}&nbsp;importantForAccessibility=\u201dno-hide-descendant\u201d&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;Text&gt;&nbsp;Second&nbsp;layout&nbsp;&lt;\/Text&gt;\n&nbsp;&nbsp;&lt;\/View&gt;\n&lt;\/View&gt;<\/pre>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728\u4e0a\u9762\u7684\u793a\u4f8b\u4e2d\uff0c\u5bf9\u4e8e TalkBack \u4ee5\u53ca\u5176\u4ed6\u7684\u8f85\u52a9\u529f\u80fd\u670d\u52a1\u800c\u8a00\uff0c\u9ec4\u8272\u7684\u5e03\u5c40\u53ca\u5176\u540e\u4ee3\u662f\u5b8c\u5168\u4e0d\u53ef\u89c1\u7684\u3002\u6240\u4ee5\u6211\u4eec\u53ef\u4ee5\u5bb9\u6613\u7684\u4f7f\u7528\u6765\u81ea\u4e8e\u540c\u4e00\u4e2a\u7236\u5143\u7d20\u5e76\u4e14\u4e0d\u5e26\u6709\u4ee4\u4eba\u7591\u60d1\u7684 TalkBack \u7684\u89c6\u56fe\u3002<\/p>\n<h3>\u53d1\u9001\u8f85\u52a9\u529f\u80fd\u4e8b\u4ef6\uff08Android\uff09<\/h3>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u6709\u65f6\u5019\u5728 UI \u7ec4\u4ef6\u4e2d\u53bb\u89e6\u53d1\u4e00\u4e2a\u8f85\u52a9\u529f\u80fd\u4e8b\u4ef6\u5f88\u6709\u7528 (\u5373\u5f53\u4e00\u4e2a\u81ea\u5b9a\u4e49\u7684\u89c6\u56fe\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u6216\u81ea\u5b9a\u4e49\u5355\u9009\u6309\u94ae\u5df2\u88ab\u9009\u4e2d)\u3002\u4e3a\u4e86\u8fbe\u5230\u8fd9\u4e2a\u76ee\u7684\uff0c\u672c\u5730 UIManager \u6a21\u5757\u516c\u5e03\u4e86\u4e00\u4e2a\u540d\u53eb 'sendAccessibilityEvent' \u7684\u65b9\u6cd5\u3002\u5b83\u62e5\u6709\u4e24\u4e2a\u53c2\u6570\uff1a \u89c6\u56fe\u6807\u7b7e\u548c\u4e00\u4e2a\u7c7b\u578b\u7684\u4e8b\u4ef6\u3002<\/p>\n<pre>_onPress:&nbsp;function()&nbsp;{&nbsp;&nbsp;this.state.radioButton&nbsp;=&nbsp;this.state.radioButton&nbsp;===&nbsp;\u201cradiobutton_checked\u201d&nbsp;?\n&nbsp;&nbsp;\u201cradiobutton_unchecked\u201d&nbsp;:&nbsp;\u201cradiobutton_checked\u201d;&nbsp;&nbsp;if&nbsp;(this.state.radioButton&nbsp;===&nbsp;\u201cradiobutton_checked\u201d)&nbsp;{\n&nbsp;&nbsp;&nbsp;&nbsp;RCTUIManager.sendAccessibilityEvent(\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;React.findNodeHandle(this),\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RCTUIManager.AccessibilityEventTypes.typeViewClicked);\n&nbsp;&nbsp;}\n}\n\n&lt;CustomRadioButton\n&nbsp;&nbsp;accessibleComponentType={this.state.radioButton}\n&nbsp;&nbsp;onPress={this._onPress}\/&gt;<\/pre>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728\u4e0a\u9762\u7684\u4f8b\u5b50\u4e2d\uff0c\u6211\u4eec\u521b\u5efa\u4e86\u4e00\u4e2a\u5982\u540c\u672c\u6309\u94ae\u7684\u81ea\u5b9a\u4e49\u5355\u9009\u6309\u94ae\u3002\u66f4\u5177\u4f53\u5730\u8bf4\uff0cTalkBack \u53ef\u4ee5\u6b63\u786e\u7684\u516c\u5e03\u5355\u9009\u6309\u94ae\u9009\u62e9\u7684\u53d8\u5316\u3002<\/p>\n<h2>\u6d4b\u8bd5 VoiceOver \u652f\u6301\u7684\u5185\u5bb9\uff08iOS\uff09<\/h2>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5982\u679c\u8981\u542f\u7528 VoiceOver\uff0c\u90a3\u4e48\u8bf7\u5728\u4f60\u7684 iOS \u8bbe\u5907\u4e0a\u6253\u5f00\u8bbe\u7f6e\u5e94\u7528\u7a0b\u5e8f\u7684\u4f4d\u7f6e\u3002\u70b9\u51fb General\uff0c\u7136\u540e\u70b9\u51fb Accessibility\u3002\u90a3\u91cc\u4f60\u4f1a\u53d1\u73b0\u8bb8\u591a\u4eba\u4eec\u7528\u6765\u4f18\u5316\u4ed6\u4eec\u7684\u8bbe\u5907\u7684\u5de5\u5177\uff0c\u6bd4\u5982\u7c97\u4f53\u6587\u672c\u3001 \u589e\u52a0\u7684\u5bf9\u6bd4\u5ea6\u4ee5\u53ca VoiceOver\u3002<\/p>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5982\u679c\u8981\u542f\u7528 VoiceOver\uff0c\u70b9\u51fb \"Vision\" \u4e0b\u7684 VoiceOver\uff0c\u6253\u5f00\u663e\u793a\u5728\u9876\u90e8\u7684\u5f00\u5173\u3002<\/p>\n<p style=\"margin: 0px 0px 10px;line-height: 26px;font-size: 14px;font-style: normal;font-variant: normal;font-weight: normal;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none\">\u5728\u8f85\u52a9\u529f\u80fd\u8bbe\u7f6e\u7684\u6700\u5e95\u90e8\uff0c\u8fd8\u6709\u4e00\u4e2a\"\u8f85\u52a9\u529f\u80fd\u7684\u5feb\u6377\u65b9\u5f0f\"\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u5b83\u4e09\u6b21\u5355\u51fb\u4e3b\u9875\u6309\u94ae\u6765\u89e6\u53d1 VoiceOver\u3002<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>iOS \u5728 iOS \u7cfb\u7edf\u4e0a\u8f85\u52a9\u529f\u80fd\u6db5\u76d6\u8bb8\u591a\u8bdd\u9898\uff0c\u4f46\u5bf9\u8bb8\u591a\u4eba\u6765\u8bf4\u8f85\u52a9\u529f\u80fd\u662f VoiceOver \u7684\u4ee3\u540d\u8bcd\uff0c\u5373 i [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[182398],"tags":[],"class_list":["post-191005","post","type-post","status-publish","format-standard","hentry","category-mini-program"],"_links":{"self":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/191005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/comments?post=191005"}],"version-history":[{"count":0,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/posts\/191005\/revisions"}],"wp:attachment":[{"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/media?parent=191005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/categories?post=191005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/idc.net\/help\/wp-json\/wp\/v2\/tags?post=191005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}