Skip to content

Instantly share code, notes, and snippets.

View ajsmth's full-sized avatar

andy ajsmth

View GitHub Profile
@ajsmth
ajsmth / yarn.lock
Created May 6, 2022 23:14
yarn.lock
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@ampproject/remapping@^2.1.0":
version "2.2.0"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.0.tgz#56c133824780de3174aed5ab6834f3026790154d"
integrity sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==
dependencies:
"@jridgewell/gen-mapping" "^0.1.0"
This file has been truncated, but you can view the full file.
{
"name": "react-native-app-template",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"dependencies": {
"@ckbab/js-utils": "^1.0.0",
"@ckbab/react-native-components": "^1.0.10",
"@react-native-async-storage/async-storage": "~1.17.3",
@ajsmth
ajsmth / EXCameraQualityBug.js
Created July 16, 2021 17:41
Video Quality Bug
import * as React from 'react';
import { Camera } from 'expo-camera';
import { View, Button, Text, useWindowDimensions, LogBox, Alert } from 'react-native';
LogBox.ignoreLogs(['-[EXCamera']);
export default function App() {
const { width, height } = useWindowDimensions();
const cameraRef = React.useRef(null);
@ajsmth
ajsmth / Checkbox.tsx
Created July 6, 2021 20:27
Checkbox Sandbox
import Checkbox from 'expo-checkbox';
import React, { useState } from 'react';
import { StyleSheet, Text, View } from 'react-native';
export default function App() {
const [isChecked, setChecked] = useState(false);
return (
<View style={styles.container}>
<View style={styles.section}>
@ajsmth
ajsmth / BackgroundFetch.tsx
Created June 16, 2021 22:29
Expo BackgroundFetch Example
import React from "react";
import { StyleSheet, Text, View, Button } from "react-native";
import * as BackgroundFetch from "expo-background-fetch";
import * as TaskManager from "expo-task-manager";
const BACKGROUND_FETCH_TASK = "background-fetch";
// 1. Define the task by providing a name and the function that should be executed
// Note: This needs to be called in the global scope (e.g outside of your React components)
TaskManager.defineTask(BACKGROUND_FETCH_TASK, async () => {
@ajsmth
ajsmth / index.tsx
Last active May 21, 2021 21:51
Splash Screen Hanger
import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import * as SplashScreen from 'expo-splash-screen';
import * as Font from 'expo-font';
import Entypo from '@expo/vector-icons/Entypo';
async function doSomeAsyncWork() {
throw new Error('123');
}
@ajsmth
ajsmth / CameraCodecExample.tsx
Created April 29, 2021 21:49
Expo Camera Codec
import { Camera } from 'expo-camera';
import React, { useState, useEffect, useRef } from 'react';
import {
StyleSheet,
Text,
View,
TouchableOpacity,
SafeAreaView,
Alert,
ScrollView,
@ajsmth
ajsmth / scrollview.tsx
Created February 26, 2020 20:11
Spotify Scrollview - Final
import React from 'react';
import {
View,
Animated,
SafeAreaView,
TouchableOpacity,
Text,
Switch,
Button,
TextInput,
@ajsmth
ajsmth / scrollview-offset.tsx
Created February 26, 2020 19:49
Setting the scrollview offset
<Animated.ScrollView
contentOffset={{y: SEARCH_PLAYLISTS_HEIGHT}}
onScroll={handleScroll}
style={{flex: 1}}>
{...}
</Animated.ScrollView>
function PlaylistProfile() {
// ...
const PLAYLIST_ITEMS_OFFSET = PLAYLIST_HERO_HEIGHT + SEARCH_PLAYLISTS_HEIGHT;
const clampShuffleButton = Animated.add(
// make the button maintain its position during scroll - i.e the center of the window
scrollY.current,
// if we havent scrolled past the hero section, have the shuffle button move up with the scrollview
scrollY.current.interpolate({