Skip to content

Instantly share code, notes, and snippets.

View EvanBacon's full-sized avatar
🥓
Markdown developer

Evan Bacon EvanBacon

🥓
Markdown developer
View GitHub Profile
@EvanBacon
EvanBacon / AndroidManifest.xml.diff
Last active November 29, 2021 16:30
Diff between SDK 42 & SDK 43 AppDelegate.m for user reference when updating dangerous Expo config plugins
diff --git a/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml b/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml
index 136676d7c5..764b402b52 100644
--- a/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml
+++ b/templates/expo-template-bare-minimum/android/app/src/main/AndroidManifest.xml
@@ -8,25 +8,20 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<!-- END OPTIONAL PERMISSIONS -->
- <application
- android:name=".MainApplication"
@EvanBacon
EvanBacon / transformAssetLocation.ts
Created August 20, 2021 20:09
Emulate "public path" functionality in React Native
import { Platform } from "react-native";
import getDevServer from "react-native/Libraries/Core/Devtools/getDevServer";
const devServerInfo = getDevServer();
/**
* Transform a local "public" path location to a URL that works in React Native.
*
* When the project is not hosted from a development server, use an offline path from an embedded asset.
*

h1

h2

h3

h4

h5
@EvanBacon
EvanBacon / 🧽.gif
Last active June 19, 2024 15:43
🥓
🧽.gif
@EvanBacon
EvanBacon / A-look-at-Hooks.md
Created June 18, 2019 22:46
A look at some different approaches to using hooks for pseudo classes.

Many ways to useHooks

When I try to learn something, I search around for the optimal approach. In the case of hooks I found two reasonable approaches and one approach that only makes sense in some use-cases. Below I've documented all of them.

Use Case (useCase 😘)

I want to change the style of a text element when the user is clicking down on it. Because this is React Native for web, there are no CSS pseudo classes, so I need to manage all of the state myself. Because classes like active, focus, hover, and visited could be commonly used the API must be very self-contained. ... and I want people to like me, so I'm using hooks (the old implementation used render props).

Spread props

@EvanBacon
EvanBacon / apple-touch-startup-image.html
Created April 17, 2019 07:10
An example of full iOS PWA startup image (splash screen) support.
<html>
<head>
<meta name="mobile-web-app-capable" content="yes" />
<meta name="apple-touch-fullscreen" content="yes" />
<meta name="apple-mobile-web-app-title" content="Expo" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="default" />
<link
rel="apple-touch-icon"
sizes="180x180"
@EvanBacon
EvanBacon / audioFormData.js
Created February 17, 2019 06:54
Upload audio data from React Native
async function uploadAudioAsync(uri) {
console.log("Uploading " + uri);
let apiUrl = 'http://YOUR_SERVER_HERE/upload';
let uriParts = uri.split('.');
let fileType = uriParts[uriParts.length - 1];
let formData = new FormData();
formData.append('file', {
uri,
name: `recording.${fileType}`,
@EvanBacon
EvanBacon / ReactNativeSimpleStyledMap.jsx
Created February 17, 2019 02:09
A custom map renderer to spice things up 🍕
import React from 'react';
// import
import { MapView } from 'expo';
export default BaseMap = ({ children, ...props }) => (
<MapView
{...props}
>
<MapView.UrlTile
/**
@EvanBacon
EvanBacon / output.sh
Created January 8, 2019 21:07
When expo build:ios works
GoogleAuthDemo $ exp build:ios -c
We've built a brand new CLI for Expo!
Expo CLI is a drop in replacement for exp.
Install: npm install -g expo-cli
Use: expo --help
Read more: https://blog.expo.io/expo-cli-2-0-released-a7a9c250e99c
[13:05:12] Making sure project is set up correctly...
[13:05:13] Your project looks good!
[13:05:13] Checking if current build exists...
@EvanBacon
EvanBacon / Instagram_App.js
Created July 6, 2018 00:29
Instagram Expo Clone Navigation
// Import React Navigation
import {
createBottomTabNavigator,
createStackNavigator,
} from 'react-navigation';
import tabBarIcon from './utils/tabBarIcon';
// Import the screens
import FeedScreen from './screens/FeedScreen';
import NewPostScreen from './screens/NewPostScreen';