@@ -12,6 +12,7 @@ import {
1212 radius ,
1313 space ,
1414 type ,
15+ useToast ,
1516} from '@wash-and-go/ui' ;
1617import { api } from '../lib/api' ;
1718import { LOAD_BUCKETS , LoadBucket } from '../lib/format' ;
@@ -48,9 +49,9 @@ export default function BookScreen() {
4849 const [ address , setAddress ] = useState ( '' ) ;
4950 const [ gpsLoading , setGpsLoading ] = useState ( false ) ;
5051 const [ geoLoading , setGeoLoading ] = useState ( false ) ;
51- const [ error , setError ] = useState < string | null > ( null ) ;
5252 const [ saved , setSaved ] = useState < AddressView [ ] > ( [ ] ) ;
5353 const [ saveNew , setSaveNew ] = useState ( false ) ;
54+ const toast = useToast ( ) ;
5455
5556 // Load the address book to prefill pickup (best-effort — booking works without).
5657 useEffect ( ( ) => {
@@ -73,29 +74,28 @@ export default function BookScreen() {
7374 const q = address . trim ( ) ;
7475 if ( q . length < 2 ) return ;
7576 setGeoLoading ( true ) ;
76- setError ( null ) ;
7777 try {
7878 const hit = await api . geocode ( q ) ;
7979 if ( hit ) {
8080 setCoords ( hit . point ) ;
8181 setAddress ( hit . label ) ;
82+ toast . success ( 'Address pinned.' ) ;
8283 } else {
83- setError ( 'No match for that address. Try GPS or add more detail.' ) ;
84+ toast . error ( 'No match for that address. Try GPS or add more detail.' ) ;
8485 }
8586 } catch {
86- setError ( 'Could not search that address. Try again or use GPS.' ) ;
87+ toast . error ( 'Could not search that address. Try again or use GPS.' ) ;
8788 } finally {
8889 setGeoLoading ( false ) ;
8990 }
9091 } , [ address ] ) ;
9192
9293 const useMyLocation = useCallback ( async ( ) => {
9394 setGpsLoading ( true ) ;
94- setError ( null ) ;
9595 try {
9696 const { status } = await Location . requestForegroundPermissionsAsync ( ) ;
9797 if ( status !== 'granted' ) {
98- setError ( 'Location permission is needed to set your pickup point.' ) ;
98+ toast . error ( 'Location permission is needed to set your pickup point.' ) ;
9999 return ;
100100 }
101101 const pos = await Location . getCurrentPositionAsync ( {
@@ -116,7 +116,7 @@ export default function BookScreen() {
116116 // best-effort
117117 }
118118 } catch {
119- setError ( 'Could not read your location. Try again or type your address.' ) ;
119+ toast . error ( 'Could not read your location. Try again or type your address.' ) ;
120120 } finally {
121121 setGpsLoading ( false ) ;
122122 }
@@ -321,8 +321,6 @@ export default function BookScreen() {
321321 < Text style = { [ type . body , { color : colors . text } ] } > Save this pickup for next time</ Text >
322322 </ Pressable >
323323
324- { error ? < Text style = { styles . error } > { error } </ Text > : null }
325-
326324 < PrimaryButton label = "Continue" onPress = { cont } disabled = { ! canContinue } />
327325 </ Screen >
328326 ) ;
@@ -358,7 +356,6 @@ const styles = StyleSheet.create({
358356 color : colors . text ,
359357 fontSize : 15 ,
360358 } ,
361- error : { color : colors . danger , ...type . body } ,
362359 defaultBadge : {
363360 backgroundColor : colors . terra ,
364361 paddingHorizontal : 8 ,
0 commit comments