单击引发handleSubmit的提交按钮时,控制台中出现错误@Nullable
public static String saveIcon(List<String> files, File directory, Drawable drawable, String name) {
String fileName = name.toLowerCase().replaceAll(" ", "_") + ".png";
File file = new File(directory, fileName);
try {
Bitmap bitmap;
if (drawable instanceof LayerDrawable) {
bitmap = Bitmap.createBitmap(
drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight(),
Bitmap.Config.ARGB_8888);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
drawable.draw(new Canvas(bitmap));
} else {
bitmap = ((BitmapDrawable) drawable).getBitmap();
}
if (files.contains(file.toString())) {
fileName = fileName.replace(".png", "_" +System.currentTimeMillis()+ ".png");
file = new File(directory, fileName);
LogUtil.e("duplicate file name, renamed: " +fileName);
}
FileOutputStream outStream = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 50, outStream);
outStream.flush();
outStream.close();
return directory.toString() + "/" + fileName;
} catch (Exception | OutOfMemoryError e) {
LogUtil.e(Log.getStackTraceString(e));
}
return null;
}
。我迷失了为什么收到此消息。有人可以解释一下吗。
路径:formValidationTest is not a function
formValidationTest.js
路径:function formValidationTest(formData) {
console.log('Test function');
return true;
}
export default formValidationTest();
从'react'导入React; 从'./formValidation'导入formValidationTest;
Signup.jsx
答案 0 :(得分:4)
您正在导出formValidationTest
函数的结果。删除括号:
export default formValidationTest;