答案 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版本更加兼容,并且今后也更加稳定:
答案 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