You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From the info you provided, you're on macOS and you don't have the react-native-windows package installed. Did you mean to log this as a Windows issue (which is this repo)? Or is this a general RN issue (iOS / Android)? Or a macOS issue (also a different repo)?
Problem Description
import React, { useState } from 'react';
import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import DocumentPicker from 'react-native-document-picker';
const FileUpload = () => {
const [selectedFile, setSelectedFile] = useState(null);
const pickDocument = async () => {
try {
const result = await DocumentPicker.pick({
type: [DocumentPicker.types.allFiles],
});
setSelectedFile(result[0]);
} catch (err) {
if (DocumentPicker.isCancel(err)) {
console.log('User cancelled the picker');
} else {
console.log('Error:', err);
}
}
};
const handleUpload = async () => {
if (!selectedFile) {
alert('Please select a file first');
return;
}
};
return (
Select File
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
padding: 20,
alignItems: 'center',
justifyContent: 'center',
},
button: {
backgroundColor: '#007AFF',
padding: 15,
borderRadius: 8,
width: '80%',
alignItems: 'center',
marginVertical: 10,
},
uploadButton: {
backgroundColor: '#34C759',
},
buttonText: {
color: 'white',
fontSize: 16,
fontWeight: 'bold',
},
fileInfo: {
marginVertical: 20,
padding: 10,
borderWidth: 1,
borderColor: '#ccc',
borderRadius: 8,
},
});
export default FileUpload;
Steps To Reproduce
Try to upload any file using formdata to the backend and it doesn't work in 0.76 versions of react-native
Expected Results
File should be successfully uploaded
CLI version
15.0.0
Environment
Community Modules
I have tried everything but nothing works please fix this issue or guide on how to fix it.
Target Platform Version
None
Target Device(s)
No response
Visual Studio Version
None
Build Configuration
None
Snack, code example, screenshot, or link to a repository
No response
The text was updated successfully, but these errors were encountered: