不变违规react-native-webview

时间:2020-02-11 15:12:20

标签: react-native

首先我安装了react-native-webview。我没有链接,因为它会自动链接。但这没用。我尝试在android中清理gradlew.bat文件。虽然没用。谁能帮我 ? enter image description here

2 个答案:

答案 0 :(得分:3)

您正在使用的库(public class MainActivity extends AppCompatActivity implements View.OnClickListener { Button north,south,east,west; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); north.setOnClickListener(this); south.setOnClickListener(this); east.setOnClickListener(this); west.setOnClickListener(this); } private void init(){ north = findViewById(R.id.north); south = findViewById(R.id.south); east = findViewById(R.id.east); west = findViewById(R.id.west); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.north: Toast.makeText(MainActivity.this,"NORTH",Toast.LENGTH_SHORT).show(); break; case R.id.south: Toast.makeText(MainActivity.this,"SOUTH",Toast.LENGTH_SHORT).show(); break; case R.id.east: Toast.makeText(MainActivity.this,"EAST",Toast.LENGTH_SHORT).show(); break; case R.id.west: Toast.makeText(MainActivity.this,"WEST",Toast.LENGTH_SHORT).show(); break; } } } )已不再 根据他们的GitHub进行维护,您可以在这里找到:

https://github.com/cssivision/react-native-qrcode#readme

该库仍在使用WebView,它曾经是核心a库的一部分,但此后已删除。它不再与 data: { labels: ['Morning', 'Afternoon', 'Night'], datasets: [{ label: 'My First dataset', backgroundColor: 'rgb(255, 99, 132)', borderColor: 'rgb(255, 99, 132)', data: a }] } 的较新版本兼容。

作为替代建议,我想向您指出react-native-qrcode,该站点仍在维护中,仅NPM每周就有大约12,000次下载。这应该证明与当前的React Native版本更加兼容,并且今后也更加稳定:

https://www.npmjs.com/package/react-native-qrcode-scanner

答案 1 :(得分:1)

嘿,我已经在here上发布了有关此问题的完整答案。


针对您的方案,现在不建议使用旧版WebView,以提高性能并减小包装尺寸。您可以通过here

找到有关此信息的更多信息

使用此命令安装新的WebView软件包

npm install --save react-native-webview 

安装上述软件包后,现在删除旧的导入,然后像这样重新导入WebView

import { WebView, } from 'react-native'; //Remove this from your imports

import { WebView } from 'react-native-webview'; //Add this to your imports