@@ -24,16 +24,16 @@ import React, {
2424 forwardRef ,
2525 useEffect ,
2626} from 'react' ;
27- import { requireNativeComponent , UIManager , findNodeHandle } from 'react-native' ;
28- import type { ViewStyle } from 'react-native' ;
27+ import { requireNativeComponent , UIManager , findNodeHandle } from 'react-native' ;
28+ import type { ViewStyle } from 'react-native' ;
2929import type {
3030 CheckoutAddressChangeStart ,
3131 CheckoutCompleteEvent ,
3232 CheckoutException ,
3333 CheckoutPaymentMethodChangeStart ,
3434 CheckoutStartEvent ,
3535} from '..' ;
36- import { useCheckoutEvents } from '../CheckoutEventProvider' ;
36+ import { useCheckoutEvents } from '../CheckoutEventProvider' ;
3737
3838export interface CheckoutProps {
3939 /**
@@ -109,17 +109,15 @@ interface NativeCheckoutWebViewProps {
109109 auth ?: string ;
110110 style ?: ViewStyle ;
111111 testID ?: string ;
112- onStart ?: ( event : { nativeEvent : CheckoutStartEvent } ) => void ;
113- onError ?: ( event : { nativeEvent : CheckoutException } ) => void ;
114- onComplete ?: ( event : { nativeEvent : CheckoutCompleteEvent } ) => void ;
112+ onStart ?: ( event : { nativeEvent : CheckoutStartEvent } ) => void ;
113+ onError ?: ( event : { nativeEvent : CheckoutException } ) => void ;
114+ onComplete ?: ( event : { nativeEvent : CheckoutCompleteEvent } ) => void ;
115115 onCancel ?: ( ) => void ;
116- onLinkClick ?: ( event : { nativeEvent : { url : string } } ) => void ;
116+ onLinkClick ?: ( event : { nativeEvent : { url : string } } ) => void ;
117117 onAddressChangeStart ?: ( event : {
118118 nativeEvent : CheckoutAddressChangeStart ;
119119 } ) => void ;
120- onPaymentMethodChangeStart ?: ( event : {
121- nativeEvent : CheckoutPaymentMethodChangeStart ;
122- } ) => void ;
120+ onPaymentMethodChangeStart ?: ( event : { nativeEvent : CheckoutPaymentMethodChangeStart ; } ) => void ;
123121}
124122
125123const RCTCheckoutWebView =
@@ -196,62 +194,48 @@ export const Checkout = forwardRef<CheckoutRef, CheckoutProps>(
196194 return ( ) => eventContext . unregisterWebView ( ) ;
197195 } , [ eventContext ] ) ;
198196
199- const handleStart = useCallback <
200- Required < NativeCheckoutWebViewProps > [ 'onStart' ]
201- > (
202- ( event : { nativeEvent : CheckoutStartEvent } ) => {
197+ const handleStart = useCallback < Required < NativeCheckoutWebViewProps > [ 'onStart' ] > (
198+ ( event ) => {
203199 onStart ?.( event . nativeEvent ) ;
204200 } ,
205201 [ onStart ] ,
206202 ) ;
207203
208- const handleError = useCallback <
209- Required < NativeCheckoutWebViewProps > [ 'onError' ]
210- > (
211- ( event : { nativeEvent : CheckoutException } ) => {
204+ const handleError = useCallback < Required < NativeCheckoutWebViewProps > [ 'onError' ] > (
205+ ( event ) => {
212206 onError ?.( event . nativeEvent ) ;
213207 } ,
214208 [ onError ] ,
215209 ) ;
216210
217- const handleComplete = useCallback <
218- Required < NativeCheckoutWebViewProps > [ 'onComplete' ]
219- > (
220- ( event : { nativeEvent : CheckoutCompleteEvent } ) => {
211+ const handleComplete = useCallback < Required < NativeCheckoutWebViewProps > [ 'onComplete' ] > (
212+ ( event ) => {
221213 onComplete ?.( event . nativeEvent ) ;
222214 } ,
223215 [ onComplete ] ,
224216 ) ;
225217
226- const handleCancel = useCallback <
227- Required < NativeCheckoutWebViewProps > [ 'onCancel' ]
228- > ( ( ) => {
218+ const handleCancel = useCallback < Required < NativeCheckoutWebViewProps > [ 'onCancel' ] > ( ( ) => {
229219 onCancel ?.( ) ;
230220 } , [ onCancel ] ) ;
231221
232- const handleLinkClick = useCallback <
233- Required < NativeCheckoutWebViewProps > [ 'onLinkClick' ]
234- > (
235- ( event : { nativeEvent : { url : string } } ) => {
222+ const handleLinkClick = useCallback < Required < NativeCheckoutWebViewProps > [ 'onLinkClick' ] > (
223+ ( event ) => {
236224 if ( ! event . nativeEvent . url ) return ;
237225 onLinkClick ?.( event . nativeEvent . url ) ;
238226 } ,
239227 [ onLinkClick ] ,
240228 ) ;
241229
242- const handleAddressChangeStart = useCallback <
243- Required < NativeCheckoutWebViewProps > [ 'onAddressChangeStart' ]
244- > (
245- ( event : { nativeEvent : CheckoutAddressChangeStart } ) => {
230+ const handleAddressChangeStart = useCallback < Required < NativeCheckoutWebViewProps > [ 'onAddressChangeStart' ] > (
231+ ( event ) => {
246232 if ( ! event . nativeEvent ) return ;
247233 onAddressChangeStart ?.( event . nativeEvent ) ;
248234 } ,
249235 [ onAddressChangeStart ] ,
250236 ) ;
251237
252- const handlePaymentMethodChangeStart = useCallback <
253- Required < NativeCheckoutWebViewProps > [ 'onPaymentMethodChangeStart' ]
254- > (
238+ const handlePaymentMethodChangeStart = useCallback < Required < NativeCheckoutWebViewProps > [ 'onPaymentMethodChangeStart' ] > (
255239 event => {
256240 if ( ! event . nativeEvent ) return ;
257241 onPaymentMethodChangeStart ?.( event . nativeEvent ) ;
@@ -274,7 +258,7 @@ export const Checkout = forwardRef<CheckoutRef, CheckoutProps>(
274258 UIManager . dispatchViewManagerCommand ( handle , commandId , [ ] ) ;
275259 } , [ ] ) ;
276260
277- useImperativeHandle ( ref , ( ) => ( { reload} ) , [ reload ] ) ;
261+ useImperativeHandle ( ref , ( ) => ( { reload } ) , [ reload ] ) ;
278262
279263 return (
280264 < RCTCheckoutWebView
0 commit comments