Skip to content

Instantly share code, notes, and snippets.

View csantarin's full-sized avatar

Cezar Andrew Villegas Santarin csantarin

View GitHub Profile
@csantarin
csantarin / TextFieldInput.tsx
Created September 24, 2020 09:01
TextFieldInput function component
import React, { useRef } from 'react';
import { StyleSheet, TextInput, TextInputProps, TouchableWithoutFeedback, View } from 'react-native';
import { FONT } from '../../../styles/fonts';
import { SEMANTIC_COLOR } from '../../../styles/semanticColors';
import TextFieldTitle, { TextFieldTitleProps } from './TextFieldTitle';
type OmitTextInputProps = Omit<TextInputProps, 'placeholder' | 'placeholderTextColor' | 'allowFontScaling' | 'multiline'>;
type TextFieldInternalProps = OmitTextInputProps & TextFieldTitleProps;
declare namespace jsObject {
/**
* Extracts the known keys of a given object type using type inference.
*
* @see [How to omit [key:string]: any from a type in typescript?](https://stackoverflow.com/a/58223140/11455106)
* @see [TypeScript: remove index signature using mapped types](https://stackoverflow.com/a/51956054/5669456)
* @see [How can I remove a wider type from a union type without removing its subtypes in TypeScript?](https://stackoverflow.com/a/51955852/5669456)
*/
type KnownKeyOf<T> = {
[K in keyof T]: string extends K ? never : number extends K ? never : K