UNPKG

@prosperitainova/dumbo-react-native

Version:
49 lines 2.84 kB
import React from 'react'; import type { CarbonIcon, StylePassing } from '../types/shared'; import { ColorValue, PressableStateCallbackType, StyleProp, ViewStyle, TextStyle } from 'react-native'; /** * Log issues in console or other system that happen during the use of the library * * @param issue - Issue string for indicating where issue came from and what it was * @param data - any useful data for debugging issue */ export declare const logIssue: (issue: string, data: unknown) => void; /** * Renders an icon from @Carbon/icons for React Native * Most have a slight padding in the SVG. You can avoid this by adding a few extra pixels to size. For example 20 base icons can be 22 to compensate and match lineHeight for some compact font styles. * * @param icon - the icon to render (`import AddIcon from '@carbon/icons/es/add/20'` for example) * @param width - width of the icon, defaults to 100% (numbers are pixels but percent in string format are supported). * @param height - height of the icon, defaults to 100% (numbers are pixels but percent in string format are supported). * @param color - color of the icon, deafults to `icon-primary` from Carbon colors for the current theme. * * @returns - React Node to render on the screen. If the icon fails to be created an X icon is rendered. */ export declare const createIcon: (icon: CarbonIcon, width?: string | number, height?: string | number, color?: ColorValue, key?: string | number) => React.ReactNode; /** * This breaks reference to the original object for style manipulation. * TODO: find out prper flow from community. * * @param style - Style to break reference to * @param extraStyle - Style to break reference to * @returns - broken reference for the style */ export declare const styleReferenceBreaker: (style: StylePassing, extraStyle?: StylePassing) => StyleProp<ViewStyle | TextStyle> & ViewStyle & TextStyle; /** * Pressable styling helper for adding proper feedback to the user * Use on Pressable as `style={(state) => pressableFeedbackStyle(state, this.myStyle)}` * * @param state - State from the style function * @param style - Primary style to add to the pressable * @param customStyle - Function to use custom styling for state changes. If using may not need this helper at all. But also not bad to have everything in one flow. * * @returns - Styled for handling press style */ export declare const pressableFeedbackStyle: (state: PressableStateCallbackType, style: StyleProp<ViewStyle>, customStyle?: (state: PressableStateCallbackType) => StyleProp<ViewStyle>) => StyleProp<ViewStyle>; /** * Safely open a URL and handle pre-checking and post handling errors if encountered. * * @param url - URL scheme to pass to OS or Intent */ export declare const openLink: (url: string) => void; //# sourceMappingURL=index.d.ts.map