Skip to content

Instantly share code, notes, and snippets.

View nandorojo's full-sized avatar

Fernando Rojo nandorojo

View GitHub Profile
@trezy
trezy / Head.jsx
Last active October 10, 2019 02:54
import NextHead from 'next/head'
import React from 'react'
import ReactGA from 'react-ga'
import Router from 'next/router'
/*****************************************************************************\
@ChronSyn
ChronSyn / demo.tsx
Created April 17, 2020 19:52
expo useNotification
import * as React from "react";
import { TouchableOpacity, Text } from "react-native";
import { Notifications } from "expo"
import { useNotification } from "./useNotification";
const sendNotification = async () => await Notifications.presentLocalNotificationAsync(
{
title: "Notified!",
body: "Hello, World!",
data: {}
import Animated, {
useSharedValue,
withTiming,
useAnimatedStyle,
Easing,
makeRemote,
withSpring,
processColor,
useValue,
delay as RDelay,
@rjerue
rjerue / Popover.js
Last active January 27, 2021 02:07
React Native Web Popovers
// web
import P, { ArrowContainer } from 'react-tiny-popover'
import React from 'react'
export default ({
visible = false,
position,
onClose,
children,
content = null,
diff --git a/node_modules/@expo/next-adapter/build/withExpo.js b/node_modules/@expo/next-adapter/build/withExpo.js
index 2e63eb4..b1cf9a9 100644
--- a/node_modules/@expo/next-adapter/build/withExpo.js
+++ b/node_modules/@expo/next-adapter/build/withExpo.js
@@ -7,8 +7,8 @@ function withExpo(nextConfig = {}) {
// Prevent define plugin from overwriting Next.js environment.
process.env.EXPO_WEBPACK_DEFINE_ENVIRONMENT_AS_KEYS = 'true';
const expoConfig = addons_1.withUnimodules(config, {
- projectRoot: nextConfig.projectRoot || process.cwd(),
- }, { supportsFontLoading: false });
@nandorojo
nandorojo / no-cache-swr.js
Created October 21, 2020 17:20
No-cache policy with Vercel's SWR
import useNativeSWR from 'swr'
import { useRef } from 'react'
// inspired by https://github.com/vercel/swr/discussions/456
export default function useSWR(key, fetcher, options = {}) {
const { cachePolicy, ...opts } = options
const random = useRef(new Date())
return useNativeSWR(
() => {
@ianmartorell
ianmartorell / HoverState.ts
Last active August 25, 2021 16:32 — forked from necolas/Hoverable.js
Hover styles in React Native for Web
/* eslint-disable no-inner-declarations */
import { canUseDOM } from 'fbjs/lib/ExecutionEnvironment';
let isEnabled = false;
if (canUseDOM) {
/**
* Web browsers emulate mouse events (and hover states) after touch events.
* This code infers when the currently-in-use modality supports hover
* (including for multi-modality devices) and considers "hover" to be enabled
@nandorojo
nandorojo / links.tsx
Created November 29, 2021 19:34
React Native + Next.js Link Components
@cmcewen
cmcewen / upload.js
Created December 29, 2015 15:38
Upload image from React Native to Cloudinary
var CryptoJS = require('crypto-js');
function uploadImage(uri) {
let timestamp = (Date.now() / 1000 | 0).toString();
let api_key = 'your api key'
let api_secret = 'your api secret'
let cloud = 'your cloud name'
let hash_string = 'timestamp=' + timestamp + api_secret
let signature = CryptoJS.SHA1(hash_string).toString();
let upload_url = 'https://api.cloudinary.com/v1_1/' + cloud + '/image/upload'
@brunotavares
brunotavares / react-native-double-tap.js
Last active June 4, 2022 17:14
Double tap gesture recognition for React Native.
const DOUBLE_PRESS_DELAY = 300;
// ...
/**
* Double Press recognition
* @param {Event} e
*/
handleImagePress(e) {
const now = new Date().getTime();