Skip to content

Instantly share code, notes, and snippets.

View wildseansy's full-sized avatar

Sean Holbert wildseansy

View GitHub Profile
@wildseansy
wildseansy / react-native-video-types.ts
Last active July 26, 2023 19:05
React Native Video Types
// This documents most of the types available in react-native-video when rendering a player
// To use these types, can inject as follows
import RNVideo from 'react-native-video';
const Video = RNVideo as unknown as React.JSXElementConstructor<VideoProps>;
// ...Now use 'Video' as your react-native-video component, and you'll get the props.
// these below types were organized in 2020, so there may be new types available now in react-native-video
// The types are below:
@wildseansy
wildseansy / App.tsx
Last active August 11, 2022 01:23
Sample React Native Styled Components App
// App.tsx
import { ThemeProvider } from "styled-components";
export const App: React.FC<{children: React.ReactNode}> = ({children}) => {
return (
<ThemeProvider theme={theme}>
{children}
</ThemeProvider>
)
}
@wildseansy
wildseansy / UsersListV2.tsx
Last active October 24, 2021 00:29
[Redux Migration Example] Step 2
import * as React from "react"
import { useSelector, useDispatch } from "react-redux"
// UserItem represents a user item in the list
import UserItem from "app/components/UserItem";
type RootReducer = {
users: UserReducerState;
}
@wildseansy
wildseansy / UsersList.tsx
Last active October 24, 2021 17:33
[Redux Migration Example] Step 1
//UsersList
import * as React from "react";
import { connect } from "react-redux";
import { User } from "app/redux/user-reducer";
// UserItem represents a user item in the list
import UserItem from "app/components/UserItem";
type Props = {
users: User[];
@wildseansy
wildseansy / UsersListV3.tsx
Last active October 29, 2021 00:24
[Redux Migration Example] Step 3
// UsersList without redux
import * as React from "react";
import { useUserStore } from "app/hooks/user-hooks"
// UserItem represents a user item in the list
import UserItem from "app/components/UserItem";
const UsersList: React.FC = () => {
const { users, updateUser, deleteUser } = useUserStore();
@wildseansy
wildseansy / sanity-face-hotspots.ts
Last active October 14, 2021 17:18
Sanity Hotspot Generation based on face
import {
RekognitionClient,
DetectFacesCommand,
DetectFacesCommandInput,
} from "@aws-sdk/client-rekognition";
import imageUrlBuilder from "@sanity/image-url";
import client, { SanityImageAssetDocument, Transaction } from "@sanity/client";
import { default as nodeFetch } from "node-fetch";
const SANITY_DATASET = "<my project dataset>";
@wildseansy
wildseansy / changes.md
Last active April 6, 2021 16:57
04-06-2021 GraphQL Changes
import computedField from 'sanity-plugin-computed-field'
import createSchema from 'part:@sanity/base/schema-creator'
import schemaTypes from 'all:part:@sanity/base/schema-type'
const Course = {
name: 'course',
title: 'Title for Course',
description: 'Represents a given course taught at Sanity U',
type: 'document',
fields: [
@wildseansy
wildseansy / schema.ts
Created February 4, 2021 21:34
Sanity: Custom Input for serialized array string
import stringEnumerator from "../../components/stringEnumerator";
export const mySchema = {
//...other fields
fruits: {
name: "fruits",
title: "Favorite Fruits",
type: "string",
inputComponent: stringEnumerator,
options: {
@wildseansy
wildseansy / LeftTabs.js
Last active May 27, 2019 22:00
Pinned left nav tabs
import React from 'react';
import {
StyleSheet,
View,
Text,
TouchableOpacity,
SafeAreaView
} from 'react-native';
import { Ionicons } from '@expo/vector-icons';