This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ConfigPlugin, withDangerousMod } from '@expo/config-plugins' | |
import { | |
MergeResults, | |
mergeContents, | |
removeContents, | |
} from '@expo/config-plugins/build/utils/generateCode' | |
import path from 'path' | |
import fs from 'fs-extra' | |
const debug = require('debug')('file-viewer-plugin') as typeof console.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Favorite({ | |
postId = null, | |
isLiked: _isLiked = false, | |
numberOfLikes: _numberOfLikes = 0, | |
}) { | |
const [isLiked, setIsLiked] = React.useState(_isLiked); | |
const [numberOfLikes, setNumberOfLikes] = React.useState(_numberOfLikes ?? 0); | |
const likeDebounceRef = React.useRef(); | |
const lastIsLikedStateRef = React.useRef(_isLiked); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Dimensions, TextInput, ScrollView } from "react-native"; | |
import Animated, { | |
useAnimatedKeyboard, | |
useAnimatedReaction, | |
runOnJS, | |
KeyboardState, | |
useAnimatedProps, | |
useAnimatedScrollHandler, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Token Based API Access for Supabase | |
-- | |
-- How to configure Supabase (https://supabase.com/) to generate and accept API tokens. | |
-- | |
-- (c) 2022 Felix Zedén Yverås | |
-- Provided under the MIT license (https://spdx.org/licenses/MIT.html) | |
-- | |
-- Disclaimer: This file is formatted using pg_format. I'm not happy with the result but | |
-- prefer to follow a tool over going by personal taste. | |
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Plugin } from 'colord' | |
declare module 'colord/colord' { | |
interface Colord { | |
contrasting(): Colord | |
} | |
} | |
const plugin: Plugin = (ColordClass) => { | |
ColordClass.prototype.contrasting = function () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createContext, forwardRef, useCallback, useMemo } from "react"; | |
import { FlatList, FlatListProps, ViewToken } from "react-native"; | |
import Animated, { useSharedValue } from "react-native-reanimated"; | |
const MAX_VIEWABLE_ITEMS = 4; | |
type ViewabilityItemsContextType = string[]; | |
export const ViewabilityItemsContext = createContext< | |
Animated.SharedValue<ViewabilityItemsContextType> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function App() { | |
const data = Array(10).fill(0); | |
const GAP = 5; | |
const numColumns = 3; | |
const { width } = Dimensions.get("window"); | |
// Reduce the size to accomodate margin space by items | |
const ITEM_SIZE = width / numColumns - ((numColumns - 1) * GAP) / numColumns; | |
const renderItem = ({ index }) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {View, StyleSheet, Text} from 'react-native'; | |
import PagerView from 'react-native-pager-view'; | |
import Animated, {useHandler, useEvent} from 'react-native-reanimated'; | |
const AnimatedPager = Animated.createAnimatedComponent(PagerView); | |
export function usePagerScrollHandler(handlers, dependencies) { | |
const {context, doDependenciesDiffer} = useHandler(handlers, dependencies); | |
const subscribeForEvents = ['onPageScroll']; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DateTimePicker.web.ts | |
import React, { useEffect, useRef, ReactElement } from 'react' | |
import { TextInput } from 'react-native' | |
import { format } from 'date-fns' | |
interface Props { | |
minimumDate: Date | |
maximumDate: Date | |
value: string | |
onChange: (value: string) => void |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/ | |
create or replace function uuid_generate_v7() | |
returns uuid | |
as $$ | |
begin | |
-- use random v4 uuid as starting point (which has the same variant we need) | |
-- then overlay timestamp | |
-- then set version 7 by flipping the 2 and 1 bit in the version 4 string | |
return encode( |
NewerOlder