Skip to content

Instantly share code, notes, and snippets.

@shafayeatsumit
Last active February 29, 2020 09:16
Show Gist options
  • Save shafayeatsumit/322184c4dccf21d8cdb005bcb9785eab to your computer and use it in GitHub Desktop.
Save shafayeatsumit/322184c4dccf21d8cdb005bcb9785eab to your computer and use it in GitHub Desktop.
loading demo
import React, { useState, useEffect, useContext, Component } from 'react';
import { View, Button } from 'react-native';
import PropTypes from 'prop-types';
import { api } from '../helpers/HttpUtils';
const data = {
medicalInformation: '',
screeningAnswers: [],
uploadedFiles: [
{
id: 0.38345180163526593,
custom: 'Resume',
fileName: {
header: 'Resume',
document_name: 'biodata sumit.pdf',
document:
'file:///var/mobile/Containers/Data/Application/DF7BF8AF-0D84-4915-812B-ADA374680588/Library/Caches/ExponentExperienceData/%2540shafayeatsumit%252FVomeApp/DocumentPicker/4C255FC6-A553-4D89-A7D2-D750035A0AF3.pdf',
document_type: 'application/pdf',
},
},
{
id: 0.3504130982028568,
custom: 'Cover Letter',
fileName: {
header: 'Cover Letter',
document_name: 'biodata sumit.pdf',
document:
'file:///var/mobile/Containers/Data/Application/DF7BF8AF-0D84-4915-812B-ADA374680588/Library/Caches/ExponentExperienceData/%2540shafayeatsumit%252FVomeApp/DocumentPicker/FD8AF7E1-CE04-4CF9-B1B4-DE239346521F.pdf',
document_type: 'application/pdf',
},
},
],
medicalCondition: true,
name: 'Sumit',
relationship: 'Gajk',
phoneNumber: 'Djll',
notes: 'Hakk',
termsChecked: true,
};
const Loading = () => {
const sendRequest = () => {
const formData = new FormData();
formData.append('opportunity', '39c0dbbe-b9ef-4307-abbd-23aa6d1c0cdb');
formData.append('notes', 'sumit hello');
formData.append('requirement', JSON.stringify({}));
console.log('sending request');
api
.post('api/volunteer/opportunity/enroll/', formData)
.then(res => console.log(res.data))
.catch(error => console.log(error.response.data));
};
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Button title="OPEN BOTTOM SHEET" onPress={sendRequest} />
</View>
);
};
Loading.propTypes = {
navigation: PropTypes.shape({
navigate: PropTypes.func.isRequired,
}).isRequired,
};
export default Loading;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment