我正在尝试使用 react-native 开发一个 android 应用程序。其中一项要求是以编程方式根据预定义的文件名自动保存捕获的图像。我正在使用 react-native-image-picker。
图像选择器的 API 没有显示以编程方式使用每个定义的文件名保存图像的方法。我正在使用的教程也没有显示。
非常感谢。
我正在尝试使用 react-native 开发一个 android 应用程序。其中一项要求是以编程方式根据预定义的文件名自动保存捕获的图像。我正在使用 react-native-image-picker。
图像选择器的 API 没有显示以编程方式使用每个定义的文件名保存图像的方法。我正在使用的教程也没有显示。
非常感谢。
我做了如下。它工作正常。
ImagePicker.launchCamera({},(responce)=>{
const localTime = new Date().getTime();
const file ={
uri : responce.uri,
//give the name that you wish to give
name :localTime +'.jpg',
method: 'POST',
path : responce.path,
type : responce.type,
notification: {
enabled: true
}
}
console.log(file);
})
}
我已经这样做了。这可能会帮助你。
ImagePicker.launchCamera({},(responce)=>{
this.setState({
pickedImage: { uri: res.uri }
});
console.log(this.state.serverTime);
const file ={
uri : responce.uri,
//give the name that you wish to give
name :this.state.currentTimeInMilisec+'.jpg',
method: 'POST',
path : responce.path,
type : responce.type,
notification: {
enabled: true
}
}
console.log(file);
})
}