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
// Maximum font size. Note For WCAG we should support at least 200% default font scale | |
const MAXIMUM_FONT_SIZE = 32; | |
/** | |
* Use to calculate a maxFontSizeMultiplier for Text components to ensure | |
* the text size doesn't go beyond MAXIMUM_FONT_SIZE. | |
* Pass the style or a fixed number. | |
* If the original size is already bigger than 32, then the size will be unchanged. | |
*/ | |
export function getMaxFontSizeMultiplier(params: number | StyleProp<TextStyle>) { |
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 {AccessibilityInfo} from 'react-native'; | |
import {createContext, PropsWithChildren, useContext, useEffect, useState} from 'react'; | |
type AccessibilitySettingsT = { | |
isReduceMotionEnabled: boolean; | |
}; | |
const ReducedMotionContext = createContext<AccessibilitySettingsT>({isReduceMotionEnabled: false}); | |
/** |
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 fs from 'fs'; | |
import * as path from 'path'; | |
import * as z from 'zod'; | |
//---------------------------------------------------------------- | |
// | |
// Outputs all xcassets-format colors into hex format, with separate light and dark mode values. | |
// IMPORTANT: this only covers a couple of the color formats Xcode uses, and may not properly handle color spaces etc. | |
// | |
// Usage: |
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 styled from 'styled-components'; // 4.1.1 | |
import * as React from "react"; | |
type SizeProp = { size: number }; | |
const A = styled.div<SizeProp>` | |
height: ${props => props.size}px; | |
`; | |
const Ac = () => <A size={99} />; |
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
/* @flow */ | |
import React, {PureComponent} from 'react'; | |
import type {Node} from 'react'; // Here's how to import the FlowType for Node (rendered react classes or null) | |
// Simple Component with Flow | |
type PropsType = { | |
a: string, | |
b: number, | |
}; |
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
##### | |
# iTerm - Display the current folder name at the top of tabs, and update when changing directory. | |
# | |
# Based on https://gist.github.com/phette23/5270658, with suggestions from the commments there | |
##### | |
addToPromptCommand() { | |
if [[ ":$PROMPT_COMMAND:" != *":$1:"* ]]; then | |
PROMPT_COMMAND="${PROMPT_COMMAND:+"$PROMPT_COMMAND:"}$1" | |
fi |
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 {rootNavigatorSelector} from './navigation/router'; | |
import Store from './redux/store'; | |
// Connect `rootNavigatorSelector` to redux. | |
const ConnectedMain = connect(state => ({ | |
Layout: rootNavigatorSelector(state), | |
}))(Main); | |
// App root component | |
class Root extends PureComponent { |
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
/** | |
* Creates and configures the Redux Store | |
*/ | |
import {createStore, applyMiddleware, compose} from 'redux'; | |
import thunkMiddleware from 'redux-thunk'; // useful for networking actions | |
import createLogger from 'redux-logger'; // log out each action | |
import {persistStore, autoRehydrate} from 'redux-persist'; | |
import rootReducer from './reducers'; // this combines all reducers into one | |
import {AsyncStorage} from 'react-native'; | |
import Console from '../Console'; |
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
// Your main root component | |
import React, {Component} from 'react-native'; | |
export class Root extends Component { | |
//.. | |
} |
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
// Makes the APKs we build be called AppName-release-buildVariant-1.2.3_4.apk | |
// | |
// To use, add this file to the root of your project (next to gradle.properties) make sure the name is artifacts.gradle. | |
// Then edit gradle.properties to include: `applicationName=MyAppName` | |
// Then edit module build.gradle, add at the end `apply from: "../artifacts.gradle"` | |
// | |
// Adapted slightly from https://www.jayway.com/2015/03/13/producing-better-named-android-apks-with-gradle/ | |
android.applicationVariants.all { variant -> | |
def appName | |
//Check if an applicationName property is supplied; if not use the name of the parent project. |
NewerOlder