@@ -16,6 +16,7 @@ const getConfig = (config: NativeConfig, key: string, defaultValue: string) => (
16
16
17
17
type AppleSignInDivProps = {
18
18
isDesktopFlow : boolean ;
19
+ onPointerDown ?: ( ) => void ;
19
20
} ;
20
21
21
22
type SingletonAppleSignInButtonProps = AppleSignInDivProps & {
@@ -24,6 +25,7 @@ type SingletonAppleSignInButtonProps = AppleSignInDivProps & {
24
25
25
26
type AppleSignInProps = WithNavigationFocusProps & {
26
27
isDesktopFlow ?: boolean ;
28
+ onPointerDown ?: ( ) => void ;
27
29
// eslint-disable-next-line react/no-unused-prop-types
28
30
onPress ?: ( ) => void ;
29
31
} ;
@@ -60,7 +62,7 @@ const failureListener = (event: AppleIDSignInOnFailureEvent) => {
60
62
/**
61
63
* Apple Sign In button for Web.
62
64
*/
63
- function AppleSignInDiv ( { isDesktopFlow} : AppleSignInDivProps ) {
65
+ function AppleSignInDiv ( { isDesktopFlow, onPointerDown } : AppleSignInDivProps ) {
64
66
useEffect ( ( ) => {
65
67
// `init` renders the button, so it must be called after the div is
66
68
// first mounted.
@@ -88,6 +90,7 @@ function AppleSignInDiv({isDesktopFlow}: AppleSignInDivProps) {
88
90
data-width = { CONST . SIGN_IN_FORM_WIDTH }
89
91
data-height = "52"
90
92
style = { { cursor : 'pointer' } }
93
+ onPointerDown = { onPointerDown }
91
94
/>
92
95
) : (
93
96
< div
@@ -99,24 +102,30 @@ function AppleSignInDiv({isDesktopFlow}: AppleSignInDivProps) {
99
102
data-border-radius = "50"
100
103
data-size = "40"
101
104
style = { { cursor : 'pointer' } }
105
+ onPointerDown = { onPointerDown }
102
106
/>
103
107
) ;
104
108
}
105
109
106
110
// The Sign in with Apple script may fail to render button if there are multiple
107
111
// of these divs present in the app, as it matches based on div id. So we'll
108
112
// only mount the div when it should be visible.
109
- function SingletonAppleSignInButton ( { isFocused, isDesktopFlow} : SingletonAppleSignInButtonProps ) {
113
+ function SingletonAppleSignInButton ( { isFocused, isDesktopFlow, onPointerDown } : SingletonAppleSignInButtonProps ) {
110
114
if ( ! isFocused ) {
111
115
return null ;
112
116
}
113
- return < AppleSignInDiv isDesktopFlow = { isDesktopFlow } /> ;
117
+ return (
118
+ < AppleSignInDiv
119
+ isDesktopFlow = { isDesktopFlow }
120
+ onPointerDown = { onPointerDown }
121
+ />
122
+ ) ;
114
123
}
115
124
116
125
// withNavigationFocus is used to only render the button when it is visible.
117
126
const SingletonAppleSignInButtonWithFocus = withNavigationFocus ( SingletonAppleSignInButton ) ;
118
127
119
- function AppleSignIn ( { isDesktopFlow = false } : AppleSignInProps ) {
128
+ function AppleSignIn ( { isDesktopFlow = false , onPointerDown } : AppleSignInProps ) {
120
129
const [ scriptLoaded , setScriptLoaded ] = useState ( false ) ;
121
130
useEffect ( ( ) => {
122
131
if ( window . appleAuthScriptLoaded ) {
@@ -136,7 +145,12 @@ function AppleSignIn({isDesktopFlow = false}: AppleSignInProps) {
136
145
return null ;
137
146
}
138
147
139
- return < SingletonAppleSignInButtonWithFocus isDesktopFlow = { isDesktopFlow } /> ;
148
+ return (
149
+ < SingletonAppleSignInButtonWithFocus
150
+ isDesktopFlow = { isDesktopFlow }
151
+ onPointerDown = { onPointerDown }
152
+ />
153
+ ) ;
140
154
}
141
155
142
156
AppleSignIn . displayName = 'AppleSignIn' ;
0 commit comments