@@ -35,7 +35,7 @@ import { checkAndRequestPermission } from '../services/PermissionsManager'
3535import { cacheStyles , type Theme , useTheme } from '../services/ThemeContext'
3636import { EdgeText , Paragraph } from '../themed/EdgeText'
3737import { ModalFooter } from '../themed/ModalParts'
38- import { SceneHeader } from '../themed/SceneHeader '
38+ import { SceneHeaderUi4 } from '../themed/SceneHeaderUi4 '
3939import { EdgeModal } from './EdgeModal'
4040
4141interface Props {
@@ -52,7 +52,7 @@ interface Props {
5252 textModalTitle ?: string
5353}
5454
55- export const ScanModal = ( props : Props ) => {
55+ export const ScanModal : React . FC < Props > = props => {
5656 const {
5757 bridge,
5858 textModalAutoFocus,
@@ -79,34 +79,34 @@ export const ScanModal = (props: Props) => {
7979 const [ torchEnabled , setTorchEnabled ] = React . useState ( false )
8080 const [ scanEnabled , setScanEnabled ] = React . useState ( false )
8181
82- const handleFlash = ( ) => {
82+ const handleFlash = ( ) : void => {
8383 triggerHaptic ( 'impactLight' )
8484 setTorchEnabled ( ! torchEnabled )
8585 }
8686
8787 // Mount effects
8888 React . useEffect ( ( ) => {
8989 setScanEnabled ( true )
90- checkAndRequestPermission ( 'camera' ) . catch ( err => {
91- showError ( err )
90+ checkAndRequestPermission ( 'camera' ) . catch ( ( error : unknown ) => {
91+ showError ( error )
9292 } )
9393 return ( ) => {
9494 setScanEnabled ( false )
9595 }
9696 } , [ ] )
9797
98- const handleBarCodeRead = ( codes : Code [ ] ) => {
98+ const handleBarCodeRead = ( codes : Code [ ] ) : void => {
9999 setScanEnabled ( false )
100100 triggerHaptic ( 'impactLight' )
101101 bridge . resolve ( codes [ 0 ] . value )
102102 }
103103
104- const handleSettings = async ( ) => {
104+ const handleSettings = async ( ) : Promise < void > => {
105105 triggerHaptic ( 'impactLight' )
106106 await Linking . openSettings ( )
107107 }
108108
109- const handleTextInput = async ( ) => {
109+ const handleTextInput = async ( ) : Promise < void > => {
110110 triggerHaptic ( 'impactLight' )
111111 const uri = await Airship . show < string | undefined > ( bridge => (
112112 < TextInputModal
@@ -124,16 +124,16 @@ export const ScanModal = (props: Props) => {
124124 }
125125 }
126126
127- const handleAlbum = ( ) => {
127+ const handleAlbum = ( ) : void => {
128128 triggerHaptic ( 'impactLight' )
129129 launchImageLibrary (
130130 {
131131 mediaType : 'photo'
132132 } ,
133133 result => {
134- if ( result . didCancel ) return
134+ if ( result . didCancel === true ) return
135135
136- if ( result . errorMessage ) {
136+ if ( result . errorMessage != null && result . errorMessage !== '' ) {
137137 showDevError ( result . errorMessage )
138138 return
139139 }
@@ -157,19 +157,18 @@ export const ScanModal = (props: Props) => {
157157 logActivity ( `QR code read from photo library.` )
158158 bridge . resolve ( response . values [ 0 ] )
159159 } )
160- . catch ( error => {
160+ . catch ( ( error : unknown ) => {
161161 showDevError ( error )
162162 } )
163163 }
164- ) . catch ( err => {
165- showError ( err )
164+ ) . catch ( ( error : unknown ) => {
165+ showError ( error )
166166 } )
167167 }
168168
169- const handleClose = ( ) => {
169+ const handleClose = ( ) : void => {
170170 triggerHaptic ( 'impactLight' )
171- // @ts -expect-error
172- bridge . resolve ( )
171+ bridge . resolve ( undefined )
173172 }
174173
175174 const airshipMarginTop = theme . rem ( 3 )
@@ -186,7 +185,7 @@ export const ScanModal = (props: Props) => {
186185 headerContainerLayout . height +
187186 ( peepholeSpaceLayout . height - holeSize ) / 2
188187
189- const renderModalContent = ( ) => {
188+ const renderModalContent = ( ) : React . ReactElement | null => {
190189 if ( ! scanEnabled ) {
191190 return null
192191 }
@@ -223,7 +222,9 @@ export const ScanModal = (props: Props) => {
223222 style = { styles . headerContainer }
224223 onLayout = { handleLayoutHeaderContainer }
225224 >
226- < SceneHeader title = { scanModalTitle } underline withTopMargin />
225+ { /* This isn't technically a scene, so just using SceneHeaderUi4 directly for simplicity. */ }
226+ { /* eslint-disable-next-line @typescript-eslint/no-deprecated */ }
227+ < SceneHeaderUi4 title = { scanModalTitle } />
227228 </ View >
228229 < View
229230 style = { [
@@ -340,8 +341,8 @@ const getStyles = cacheStyles((theme: Theme) => ({
340341 } ,
341342 headerContainer : {
342343 justifyContent : 'flex-end' ,
343- marginBottom : theme . rem ( 0.5 ) ,
344- marginTop : theme . rem ( 1 )
344+ marginTop : theme . rem ( 2 ) ,
345+ marginLeft : theme . rem ( 0.5 )
345346 } ,
346347 peepholeSpace : {
347348 flex : 2
0 commit comments