小编Har*_*gra的帖子

有没有办法在 react-native-webview 中禁用 hapticFeedback

 <ScrollView
      ref={scrollRef}
      horizontal
      scrollEnabled={isScroll}
      contentContainerStyle={{height: HEIGHT, overflow: 'hidden'}}
      style={{
        width: metrics.screenWidth - widthOffset,
      }}
      onScroll={_onScroll}>
      <WebView
        ref={webviewRef}
        automaticallyAdjustContentInsets={false}
        scrollEnabled={false}
        showsHorizontalScrollIndicator={false}
        showsVerticalScrollIndicator={false}
        onLoadEnd={_loadEnd}
        bounces={false}
        source={{
          html: getHtml(final, scale),
        }}
        style={{
          height: HEIGHT,
          width: WIDTH,
          backgroundColor: 'transparent',
        }}
        onMessage={_onMessage}
        javaScriptEnabled={true}
        textZoom={90}
      />
    </ScrollView>
Run Code Online (Sandbox Code Playgroud)

还有

source.replace(
    '<img',
    '<img ontouchend="window.ReactNativeWebView.postMessage(`imgsrc__`+this.src)"',
)
Run Code Online (Sandbox Code Playgroud)

所以问题是当我在 html img 上滚动这个滚动视图时,它会得到触摸并且手机会振动。有没有办法从源端(html)或 react-native-webview 端禁用 webview 触觉反馈?

我认为这是因为在滚动 img 标签时将交互视为 longtouch,因此它在 webview 中启用 longtouch。

html javascript css react-native react-native-webview

6
推荐指数
1
解决办法
388
查看次数