Skip to content

Instantly share code, notes, and snippets.

View biancadragomir's full-sized avatar

Bianca Dragomir biancadragomir

View GitHub Profile
@biancadragomir
biancadragomir / FileUploadService.ts
Created March 24, 2021 14:24
Using RNFetchBlob for a put/post multipart request
export const uploadFile = async (
record: Record,
date: string,
description: string,
recordId?: string
) => {
var headers = await defaultHeaders();
headers["Content-Type"] = "multipart/form-data";
const realPath =
export const downloadFile = async (file: GenericFile) => {
const signalError = () => {
showMessage(i18n.t('file_download_failed'), colors.RED);
};
const signalSuccess = () => {
showMessage(i18n.t('file_download_success'), colors.GREEN);
};
const downloadUrl = await buildDownloadUrl(file);
import PushNotificationIOS from '@react-native-community/push-notification-ios';
import { Platform } from 'react-native';
import PushNotification from 'react-native-push-notification';
class NotificationManager {
configure = () => {
PushNotification.configure({
onRegister: function (token: any) {
console.log('TOKEN:', token);
},
/**
* @format
*/
import PushNotificationIOS from '@react-native-community/push-notification-ios';
import { AppRegistry } from 'react-native';
import PushNotification from 'react-native-push-notification';
import App from './App';
import { name as appName } from './app.json';
@biancadragomir
biancadragomir / index.tsx
Created October 8, 2021 16:50
Layout component
// ...
export const Layout = () => {
// will be true on all devices smaller than a desktop
const isDesktopOrUp = useMediaQuery((theme: Theme) => theme.breakpoints.up('lg'));
return <Grid container direction="column">
<Header />
<Content />
// the bottom navigation will be visible on tablets and mobile phones
@biancadragomir
biancadragomir / index.tsx
Last active October 8, 2021 17:29
Content
import React from 'react';
import * as routes from '../routes';
import { Route, Switch } from 'react-router-dom';
export const Content = () => {
return (
<Switch>
<Route exact path={routes.home} component={HomePage}/
<Route exact path={routes.spaceships} component={SpaceshipsPage} />
<Route exact path={routes.planets} component={PlanetsPage} /
<Hidden lgUp>
<BottomNavigationMenu />
</Hidden>
<Hidden smDown lgUp>
// ...
</Hidden>
import {
BottomNavigation,
BottomNavigationAction,
Hidden,
} from '@material-ui/core';
import Drawer from '../../../../src/app/Drawer';
import * as routes from '../../../app/routes';
import { useTranslation } from 'react-i18next';
import { useStyles } from './styles';
import { useHistory } from 'react-router-dom';
import { makeStyles } from '@material-ui/core';
export const useStyles = makeStyles((theme) => ({
bottomNavigation: {
position: 'sticky',
paddingLeft: 16,
paddingRight: 16,
bottom: 0,
// ...
}