Skip to content

Instantly share code, notes, and snippets.

View jgcmarins's full-sized avatar

João Marins jgcmarins

View GitHub Profile
@jgcmarins
jgcmarins / react-native-upgrade.md
Last active January 16, 2025 11:27 — forked from julioxavierr/react-native-update.md
Steps to Upgrade a React Native App

React Native Upgrade Path

  1. Change React and React Native versions in package.json
  2. Run yarn install to upgrade dependencies
  3. Run yarn outdated or yarn upgrade-interactive to upgrade outdated libraries. Make sure that there's no breaking changes, check release notes (one by one).
  4. Compare your changes with the diff or use the upgrade-helper and update the native code.
  5. Open Xcode and link the binaries
  6. Run iOS
  7. Test iOS
  8. Run on Android
  9. Test Android
@jgcmarins
jgcmarins / Environment.tsx
Created November 15, 2019 17:18 — forked from AugustoCalaca/Environment.tsx
New logger event-based relay
import {
Environment,
Network,
RecordSource,
Store,
} from 'relay-runtime';
import { RelayTransactionLogger } from './RelayTransactionLogger';
// Define a function that fetches the results of an operation (query/mutation/etc)
import { useNavigationParam } from 'react-navigation-hooks';
import { graphql, usePreloadedQuery } from 'react-relay/hooks';
const query = graphql`
query TaskDetailQuery($nodeId: ID!) {
task: node(id: $nodeId) {
... on Task {
title
}
}
@jgcmarins
jgcmarins / KeyboardSpacer.tsx
Created December 13, 2019 14:28 — forked from satya164/KeyboardSpacer.tsx
Spacer component to handle keyboard show and hide
import * as React from 'react';
import { Animated, Keyboard, KeyboardEvent, Platform } from 'react-native';
type Props = {
offset?: number;
};
type State = {
keyboardHeightAnim: Animated.Value;
};
@jgcmarins
jgcmarins / Homepage.tsx
Created December 31, 2019 01:21 — forked from AndrewIngram/Homepage.tsx
Next.js serverless dynamic routing with centralised routes
// src/pages/Homepage.tsx
import React from "react";
export default function Homepage() {
return <div>Homepage/div>;
}
import React, { useCallback, useState } from "react"
import { useDropzone } from "react-dropzone"
import mime from "mime-types"
import firebase, { storage } from "../../firebase/firebaseServices"
interface IFileUpload {
path: string,
onUpload: (filePath: string) => void,
}
@jgcmarins
jgcmarins / mapboxToAddress.ts
Created January 30, 2020 21:46
Mapbox helpers
import idx from 'idx';
import { ForwardFeature } from './mapboxTypes';
export interface AddressResult {
id?: string | null;
fullAddress?: string | null;
shortAddress?: string | null;
zipcode?: string | null;
street?: string | null;
@jgcmarins
jgcmarins / webpack.config.js
Created February 5, 2020 17:21 — forked from sibelius/webpack.config.js
current webpack config
const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const dotEnv = require('dotenv-webpack');
const HappyPack = require('happypack');
const Serve = require('webpack-plugin-serve');
const workboxPlugin = require('workbox-webpack-plugin');
const PORT = process.env.PORT;
@jgcmarins
jgcmarins / batchCursor.ts
Created February 11, 2020 15:14 — forked from sibelius/batchCursor.ts
Mongo cursor processing - let you select a strategy of how to process elements of a Cursor so you can iterate through all items
/*
* Usage
* let cursor = Test.find().sort({ name: 1 }).cursor();
const get = makeGen(cursor, 100);
let first100 = await get.next();
console.log(first100.value.length);
https://gist.github.com/lineus/3f7d826a21796129db968d6590c93faa
*/
export async function* batchCursor(c, n) {
const cursor = c;
@jgcmarins
jgcmarins / js2tsx.sh
Created February 19, 2020 12:17 — forked from sibelius/js2tsx.sh
Rename .js files to .tsx files
find src -name "*.js" -exec sh -c 'mv "$0" "${0%.js}.tsx"' {} \;