当前位置: 首页 > news >正文

reactNative跳转appstore链接报错:Redirection to URL with a scheme that is not HTTP(S)

在reactnative中webview跳转H5下载页面,包错Redirection to URL with a scheme that is not HTTP(S)
在webview中添加一下代码
 

const onShouldStartLoadWithRequest = (event: any) => {const { url } = event;console.log(url);if (url.startsWith('https://itunes.apple.com')) {Linking.canOpenURL(url).then(res => {if (res) {Linking.openURL(url);}});return false;}return true; // 允许WebView加载其他链接};

render函数中

<WebViewref={webViewRef}startInLoadingStaterenderLoading={() => (<View style={styles.loadingContainer}><Lottiesource={require('./loading.json')}autoPlayloopstyle={{ width: 150, height: 150 }}/></View>)}source={{ uri: route?.params?.uri }}onLoadEnd={() => {// 在Vue 3页面加载完成后,再发送数据sendDataToVue({messageCenter: data,rnApp: true,location: location,});}}onMessage={handlemessage}injectedJavaScript={`window.postMessage(${JSON.stringify(JSON.stringify({messageCenter: data,rnApp: true,location: location,}),)})`}originWhitelist={['*']}style={styles.container}onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}/>

onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}是关键,可以解决ios跳转appstore下载界面报错问题

http://www.lryc.cn/news/124793.html

相关文章:

  • html css实现爱心
  • react中使用shouldComponentUpdate生命周期函数调用setState引起的无限循环的错误
  • 麦肯锡发布《2023科技趋势展望报告》,生成式AI、下一代软件开发成为趋势,软件测试如何贴合趋势?
  • 【爬虫】P1 对目标网站的背景调研(robot.txt,advanced_search,builtwith,whois)
  • maven如何建立JavaWeb项目并连接数据库,验证登录
  • CVPR 2023 | 用户可控的条件图像到视频生成方法(基于Diffusion)
  • 动态规划(基础)
  • 【Pytorch:nn.Embedding】简介以及使用方法:用于生成固定数量的具有指定维度的嵌入向量embedding vector
  • 动态库的命名规则
  • 【Linux】网络---->网络理论
  • Android学习之路(4) UI控件之输入框
  • 1.初识Web
  • 【微服务技术一】Eureka、Nacos、Ribbon(配置管理、注册中心、负载均衡)
  • 【Linux】可重入函数 volatile关键字 以及SIGCHLD信号
  • 【动态规划】回文串问题
  • Laravel Swift Mail发送带附件的邮件报错 “Swift_IoException The path cannot be empty“处理
  • Linux下常见的代理服务器软件介绍
  • SCSS的基本用法
  • alertmanager创建nginx-ingress basic auth鉴权
  • 系列六、Redis中的五大数据类型及相关操作
  • 四大运营商的大流量卡测评,看完您会选哪个运营商?
  • Apache-Maven
  • 什么是原子交换?
  • java springboot word文档转pdf
  • 【Leetcode Sheet】Weekly Practice 2
  • 【BERTopic应用 03/3】:微调参数
  • 2023年上半年数学建模竞赛题目汇总与难度分析
  • Linux下搭建java环境
  • String、StringBuffer、StringBuilder三者的异同?
  • htmlCSS-----弹性布局案例展示