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
export const intersperse = <T>(arr: T[], separator: (n: number) => T): T[] => | |
arr.flatMap(arr, (a, i) => i > 0 ? [separator(i-1), a] : [a])) |
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, { | |
useCallback, | |
useEffect, | |
useMemo, | |
useRef, | |
useState, | |
} from 'react'; | |
import useConstant from 'use-constant'; | |
import produce from 'immer'; | |
import { useIsMountedFn } from './useIsMounted'; |
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'; | |
const generateHolderKey = (() => { | |
let counter = 0; | |
return () => { | |
counter += 1; | |
return `holder_${counter}`; | |
}; | |
})(); |
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
const setupAppOverTheAirUpdates = () => { | |
const checkForUpdates = async () => { | |
if (__DEV__) { | |
console.debug('checkForUpdates disabled in DEV'); | |
return; | |
} | |
try { | |
const update = await Updates.checkForUpdateAsync(); | |
console.debug('checkForUpdates result', update); | |
if (update.isAvailable) { |
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 { Alert } from 'react-native'; | |
// An alert implementation that returns a promise when the choise is done | |
export const AlertAsync = ( | |
title, | |
message, | |
buttons = [], | |
options = {}, | |
type, | |
) => { |
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'; | |
// Permit to create a provider/consumer but allow the consumer | |
// to also receive a setter to update the provider value | |
export const createUpdatableContext = () => { | |
const { Provider, Consumer } = React.createContext(null); | |
class UpdatableContextProvider extends React.Component { | |
constructor(props) { | |
super(props); |
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 { AppLoading } from 'expo'; | |
import { Centered } from 'common/components/utils/Layout'; | |
import { BaseText } from 'common/styleguide/texts'; | |
import SimpleButton from 'common/components/buttons/SimpleButton'; | |
import CustomSafeAreaView from 'common/components/utils/CustomSafeAreaView'; | |
import { reportError } from 'AppSentry'; | |
const TechnicalErrorScreen = ({ onRetry }) => ( | |
<CustomSafeAreaView> |
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, { Component } from 'react'; | |
import {View} from "glamorous-native"; | |
import * as Colors from "colors"; | |
import {getColor} from "colors"; | |
import { greyD } from "colors"; | |
const Separator = ({ |