Skip to content

Commit 1f67c8f

Browse files
committed
feat(toast): add doc file
1 parent 26722fc commit 1f67c8f

File tree

9 files changed

+347
-23
lines changed

9 files changed

+347
-23
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</p>
99

1010
<p align="center">
11-
v1.0.0-beta.3
11+
v1.0.0-beta.4
1212
</p>
1313

1414
## Preview App
@@ -183,6 +183,7 @@ export default function MyComponent() {
183183
- [Switch](./src/components/switch/switch.md)
184184
- [Tabs](./src/components/tabs/tabs.md)
185185
- [Text Field](./src/components/text-field/text-field.md)
186+
- [Toast](./src/components/toast/toast.md)
186187

187188
## Changelog
188189

example/src/app/(home)/components/toast.tsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,11 @@ const FromNativeModalContent = () => {
385385
// ------------------------------------------------------------------------------
386386

387387
const CustomToastsContent = () => {
388-
const { toast } = useToast();
388+
const { toast, isToastVisible } = useToast();
389389
const LOADING_TOAST_ID = 'loading-toast';
390390
const PROGRESS_TOAST_ID = 'progress-toast';
391-
const { isLoading, setIsLoading } = useLoadingState();
392-
const { progress, setProgress, resetProgress } = useProgressState();
391+
const { setIsLoading } = useLoadingState();
392+
const { setProgress, resetProgress } = useProgressState();
393393

394394
/**
395395
* Simulates loading data (e.g., API call, file upload, etc.)
@@ -482,8 +482,6 @@ const CustomToastsContent = () => {
482482
}
483483
};
484484

485-
const isDisabled = isLoading || (progress > 0 && progress < 100);
486-
487485
return (
488486
<View className="flex-1 items-center justify-center px-5 gap-5">
489487
<Button
@@ -495,22 +493,23 @@ const CustomToastsContent = () => {
495493
component: renderAchievementToast,
496494
});
497495
}}
496+
isDisabled={isToastVisible}
498497
>
499498
Achievement toast
500499
</Button>
501500

502501
<Button
503502
variant="secondary"
504503
onPress={handleShowLoadingToast}
505-
isDisabled={isDisabled}
504+
isDisabled={isToastVisible}
506505
>
507506
Load data
508507
</Button>
509508

510509
<Button
511510
variant="secondary"
512511
onPress={handleShowProgressToast}
513-
isDisabled={isDisabled}
512+
isDisabled={isToastVisible}
514513
>
515514
Start upload
516515
</Button>

example/src/app/(home)/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const cards: HomeCardProps[] = [
3838
'https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/images/heroui-native-example/home-components-light.png',
3939
imageDark:
4040
'https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/images/heroui-native-example/home-components-dark.png',
41-
count: 21,
41+
count: 22,
4242
footer: 'Explore all components',
4343
path: 'components',
4444
},
@@ -157,7 +157,7 @@ export default function App() {
157157
return (
158158
<ScreenScrollView>
159159
<View className="items-center justify-center my-4">
160-
<AppText className="text-muted text-base">v1.0.0-beta.3</AppText>
160+
<AppText className="text-muted text-base">v1.0.0-beta.4</AppText>
161161
</View>
162162
<View className="gap-6">
163163
{cards.map((card, index) => (

src/components/text-field/text-field.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ const TextFieldInput = forwardRef<TextInputType, TextFieldInputProps>(
134134
colors: customColors,
135135
animationConfig,
136136
isInvalid: localIsInvalid,
137+
onFocus,
138+
onBlur,
137139
...restProps
138140
} = props;
139141

@@ -242,14 +244,14 @@ const TextFieldInput = forwardRef<TextInputType, TextFieldInputProps>(
242244
isFocused.set(withTiming(1, timingConfig));
243245
currentBgColor.set(focusBackground);
244246
currentBorderColor.set(focusBorder);
245-
restProps.onFocus?.(e);
247+
onFocus?.(e);
246248
};
247249

248250
const handleBlur = (e: NativeSyntheticEvent<TextInputFocusEventData>) => {
249251
isFocused.set(withTiming(0, timingConfig));
250252
currentBgColor.set(blurBackground);
251253
currentBorderColor.set(blurBorder);
252-
restProps.onBlur?.(e);
254+
onBlur?.(e);
253255
};
254256

255257
return (

0 commit comments

Comments
 (0)