Skip to content

Commit

Permalink
Merge pull request #83 from hknakn/fix-typos-and-param-name
Browse files Browse the repository at this point in the history
typo fixes for "swipToDismissDirection" and "ivertProps".
  • Loading branch information
gunnartorfis authored Sep 11, 2024
2 parents b19d128 + 411ecf2 commit 1a3f524
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/docs/Toaster.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ import { ZView } from 'react-native-z-view';
| gap | Gap between toasts when expanded | `16` |
| icons | Changes the default icons | `-` |
| pauseWhenPageIsHidden | Pauses toast timers when the app enters background. | `{}` |
| `swipToDismissDirection` | Swipe direction to dismiss (`left`, `up`). | `up` |
| `swipeToDismissDirection` | Swipe direction to dismiss (`left`, `up`). | `up` |
| cn | Custom function for constructing/merging classes. | `filter(Boolean).join(' ')` |
|  ToasterOverlayWrapper |  Custom component to wrap the Toaster. | `div` |
|  autoWiggleOnUpdate | Adds a wiggle animation on toast update. `never`, `toast-change`, `always` | `never` |
2 changes: 1 addition & 1 deletion docs/docs/sonner.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
| toastOptions |||
| gap |||
| icons |||
| `swipToDismissDirection` |||
| `swipeToDismissDirection` |||
| dir |||
| richColors |||
| expand | 🕸️ ||
Expand Down
2 changes: 1 addition & 1 deletion example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const App: React.FC = () => {
position="top-center"
// offset={100}
duration={3000}
swipToDismissDirection="up"
swipeToDismissDirection="up"
visibleToasts={4}
closeButton
autoWiggleOnUpdate="toast-change"
Expand Down
2 changes: 1 addition & 1 deletion src/gestures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const ToastSwipeHandler: React.FC<
important,
}) => {
const translate = useSharedValue(0);
const { swipToDismissDirection: direction, gap } = useToastContext();
const { swipeToDismissDirection: direction, gap } = useToastContext();

const pan = Gesture.Pan()
.onBegin(() => {
Expand Down
8 changes: 4 additions & 4 deletions src/toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const ToasterUI: React.FC<ToasterProps> = ({
position = toastDefaultValues.position,
offset = toastDefaultValues.offset,
visibleToasts = toastDefaultValues.visibleToasts,
swipToDismissDirection = toastDefaultValues.swipeToDismissDirection,
swipeToDismissDirection = toastDefaultValues.swipeToDismissDirection,
closeButton,
invert,
toastOptions = {},
Expand Down Expand Up @@ -183,8 +183,8 @@ export const ToasterUI: React.FC<ToasterProps> = ({
duration: duration ?? toastDefaultValues.duration,
position: position ?? toastDefaultValues.position,
offset: offset ?? toastDefaultValues.offset,
swipToDismissDirection:
swipToDismissDirection ?? toastDefaultValues.swipeToDismissDirection,
swipeToDismissDirection:
swipeToDismissDirection ?? toastDefaultValues.swipeToDismissDirection,
closeButton: closeButton ?? toastDefaultValues.closeButton,
unstyled: unstyled ?? toastDefaultValues.unstyled,
addToast: addToastHandler,
Expand All @@ -203,7 +203,7 @@ export const ToasterUI: React.FC<ToasterProps> = ({
duration,
position,
offset,
swipToDismissDirection,
swipeToDismissDirection,
closeButton,
unstyled,
invert,
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export type ToasterProps = {
info?: React.ReactNode;
loading?: React.ReactNode;
};
swipToDismissDirection?: ToastSwipeDirection;
swipeToDismissDirection?: ToastSwipeDirection;
pauseWhenPageIsHidden?: boolean;
cn?: (...classes: Array<string | undefined>) => string;
ToasterOverlayWrapper?: React.ComponentType<{ children: React.ReactNode }>;
Expand All @@ -150,7 +150,7 @@ export type ToasterContextType = Required<
Pick<
ToasterProps,
| 'duration'
| 'swipToDismissDirection'
| 'swipeToDismissDirection'
| 'closeButton'
| 'position'
| 'invert'
Expand Down
4 changes: 2 additions & 2 deletions src/use-colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ const dark: typeof light = {
'info': '#B3CDFF',
};

export const useColors = (ivertProps?: boolean) => {
export const useColors = (invertProps?: boolean) => {
const { invert: invertCtx, theme } = useToastContext();
const systemScheme = useColorScheme();
const scheme = theme === 'system' ? systemScheme : theme;
const invert = ivertProps ?? invertCtx;
const invert = invertProps ?? invertCtx;

if (scheme === 'dark') {
if (invert) return light;
Expand Down

0 comments on commit 1a3f524

Please sign in to comment.