@gaddario98/react-native-core
Version:
```bash npm install @gaddario98/native ```
164 lines (150 loc) • 6.29 kB
TypeScript
export * from '@gaddario98/react-core/auth';
import * as _tanstack_query_persist_client_core from '@tanstack/query-persist-client-core';
import { CoreConfig } from '@gaddario98/react-core';
import * as React$1 from 'react';
import React__default from 'react';
import * as Notifications from 'expo-notifications';
import { FieldValues } from '@gaddario98/react-core/form';
export * from '@gaddario98/react-core/form';
import * as react_jsx_runtime from 'react/jsx-runtime';
import { NativeStackHeaderProps, NativeStackNavigationOptions } from '@react-navigation/native-stack';
import { Href, HrefObject } from 'expo-router';
export * from '@gaddario98/react-core/localization';
import { DefaultContainerProps, ViewSettings } from '@gaddario98/react-core/pages';
export * from '@gaddario98/react-core/pages';
import { QueriesArray } from '@gaddario98/react-core/queries';
export * from '@gaddario98/react-core/queries';
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
export * from '@gaddario98/react-core/utiles';
export { AtomGeneratorOptions, AtomState, PrimitiveAtom, SyncStorage, atomStateGenerator } from '@gaddario98/react-core/state';
declare const asyncStoragePersister: _tanstack_query_persist_client_core.Persister;
declare const useReactNativeCoreConfig: (props: Partial<CoreConfig>) => void;
declare const ReactNativeCoreProvider: ({ children, coreConfig, }: {
children: React.ReactNode;
coreConfig?: Partial<CoreConfig>;
}) => React$1.ReactNode;
type NotificationPermissionStatus = "granted" | "denied" | "undetermined";
interface UseNotificationsReturn {
expoPushToken: string;
permissionStatus: NotificationPermissionStatus | null;
initializeNotifications: (id: string) => Promise<void>;
sendLocalNotification: (title: string, body: string, data?: Record<string, unknown>) => Promise<void>;
}
interface Props {
updateToken: (token: string) => Promise<void>;
setNotification: (notification: Notifications.Notification) => void;
}
declare const useExpoNotifications: ({ updateToken, setNotification, }: Props) => UseNotificationsReturn;
interface Screen {
name: string;
requireAuth?: boolean;
hideIfAuth?: boolean;
ns?: string;
userType?: string;
redirectTo?: Href | "tab";
header?: (props: NativeStackHeaderProps) => React.ReactNode;
options?: NativeStackNavigationOptions;
}
interface LayoutGeneratorProps {
screens: Screen[];
userType?: string;
initialRouteName?: string;
}
interface LayoutGeneratorConfig {
header?: (props: NativeStackHeaderProps) => React.ReactNode;
}
declare const LayoutGenerator: ({ screens, userType, initialRouteName, }: LayoutGeneratorProps) => react_jsx_runtime.JSX.Element;
declare let layoutGeneratorConfig: LayoutGeneratorConfig;
declare const setLayoutGeneratorConfig: (config: LayoutGeneratorConfig) => void;
declare const DefaultView: <F extends FieldValues, Q extends QueriesArray, V extends Record<string, unknown>>({ viewSettings, handleRefresh, children, }: DefaultContainerProps<F, Q, V>) => react_jsx_runtime.JSX.Element;
declare const Element: <F extends FieldValues = FieldValues, Q extends QueriesArray = QueriesArray, V extends Record<string, unknown> = Record<string, unknown>>({ children, withoutPadding, }: Omit<DefaultContainerProps<F, Q, V>, "viewSettings"> & ViewSettings["header"]) => react_jsx_runtime.JSX.Element;
declare const storage: {
getItem: (key: string) => Promise<string | null>;
setItem: (key: string, value: string) => Promise<void>;
removeItem: (key: string) => Promise<void>;
};
declare const setReactNativeStorage: () => void;
interface TabItemConfig {
name: string;
tabBarIcon?: (props: {
focused: boolean;
color: string;
size: number;
}) => React__default.ReactNode;
title?: string;
initialParams?: Record<string, any>;
href?: string | HrefObject;
badge?: number | string;
badgeColor?: string;
badgeTextColor?: string;
accessibilityLabel?: string;
}
type TabBarVariant = "auto" | "top" | "bottom";
type BarShadow = {
color?: string;
opacity?: number;
radius?: number;
offset?: {
height: number;
width: number;
};
elevation?: number;
};
type BarBorder = {
width?: number;
color?: string;
topOnly?: boolean;
};
interface TabLayoutProps {
tabs: Array<TabItemConfig>;
ns?: string;
initialRouteName?: string;
translateTitles?: boolean;
onTabChange?: (prev: string | undefined, next: string) => void;
bar?: {
height?: number;
position?: "absolute" | "relative";
margin?: {
bottom?: number;
horizontal?: number;
};
padding?: {
top?: number;
bottom?: number;
horizontal?: number;
};
rounded?: boolean | number;
radius?: number | {
topLeft?: number;
topRight?: number;
bottomLeft?: number;
bottomRight?: number;
};
colors?: {
background?: string;
activeTint?: string;
inactiveTint?: string;
border?: string;
shadow?: string;
surface?: string;
secondary?: string;
onSecondary?: string;
};
shadow?: boolean | BarShadow;
border?: boolean | BarBorder;
glass?: boolean | {
alpha?: number;
};
compact?: boolean;
useSafeAreaInset?: boolean;
style?: StyleProp<ViewStyle>;
itemStyle?: StyleProp<ViewStyle>;
labelStyle?: StyleProp<TextStyle>;
glowItemStyle?: StyleProp<ViewStyle>;
};
}
declare const _default: React__default.NamedExoticComponent<TabLayoutProps>;
declare const useActiveTab: <T extends string>() => T;
declare const openLink: (url: string) => void;
export { DefaultView, Element, LayoutGenerator, ReactNativeCoreProvider, _default as TabLayout, asyncStoragePersister, layoutGeneratorConfig, openLink, setLayoutGeneratorConfig, setReactNativeStorage, storage, useActiveTab, useExpoNotifications, useReactNativeCoreConfig };
export type { LayoutGeneratorConfig, LayoutGeneratorProps, Screen, TabBarVariant, TabItemConfig, TabLayoutProps, UseNotificationsReturn };