UNPKG

native-base

Version:

Essential cross-platform UI components for React Native

25 lines (21 loc) 557 B
export const dropdownDefaultStateValues = { highlightedIndex: -1, isOpen: false, selectedItem: null, inputValue: '', }; export function capitalizeString(string: string) { return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`; } export function getDefaultValue( props: any, propKey: any, defaultStateValues = dropdownDefaultStateValues ) { const defaultPropKey = `default${capitalizeString(propKey)}`; if (defaultPropKey in props) { return props[defaultPropKey]; } //@ts-ignore return defaultStateValues[propKey]; }