@@ -185,12 +185,17 @@ type FocusRingRadius =
185185 | 'focusRing--radiusSmall'
186186 | 'focusRing--radiusMedium'
187187 | 'focusRing--radiusLarge'
188+ | 'focusRing--radiusCustom'
188189
189- const getFocusRingRadius = ( borderRadius : ViewProps [ 'borderRadius' ] ) => {
190+ const getFocusRingRadius = (
191+ borderRadius : ViewProps [ 'borderRadius' ] ,
192+ props : ViewProps
193+ ) => {
190194 const baseRadiusStyle = 'focusRing--radius'
191-
192195 const initialValue = ( borderRadius || '' ) . trim ( ) . split ( ' ' ) [ 0 ]
193-
196+ if ( props . focusRingBorderRadius ) {
197+ return `${ baseRadiusStyle } Custom`
198+ }
194199 if ( verifyUniformValues ( initialValue , borderRadius ) ) {
195200 const capitalize = ( str : string ) =>
196201 `${ str . charAt ( 0 ) . toUpperCase ( ) } ${ str . slice ( 1 ) } `
@@ -242,7 +247,8 @@ const getFocusStyles = (props: ViewProps, componentTheme: ViewTheme) => {
242247 focusPosition,
243248 position,
244249 shouldAnimateFocus,
245- borderRadius
250+ borderRadius,
251+ focusRingBorderRadius
246252 } = props
247253 const focusOutline = getFocusOutline ( props )
248254 const shouldUseBrowserFocus = typeof focusOutline === 'undefined'
@@ -269,7 +275,7 @@ const getFocusStyles = (props: ViewProps, componentTheme: ViewTheme) => {
269275 }
270276
271277 if ( position === 'relative' ) {
272- const focusRingRadius = getFocusRingRadius ( borderRadius )
278+ const focusRingRadius = getFocusRingRadius ( borderRadius , props )
273279 const focusRingVariants : PartialRecord < FocusRingRadius , string | 0 > = {
274280 'focusRing--radiusInherit' : 'inherit' ,
275281 'focusRing--radiusNone' : 0
@@ -289,6 +295,9 @@ const getFocusStyles = (props: ViewProps, componentTheme: ViewTheme) => {
289295 } ,
290296 'focusRing--radiusLarge' : {
291297 borderRadius : `calc(${ componentTheme . borderRadiusLarge } + (${ componentTheme . focusOutlineOffset } - ${ componentTheme . focusOutlineWidth } ))`
298+ } ,
299+ 'focusRing--radiusCustom' : {
300+ borderRadius : `calc(${ focusRingBorderRadius } + (${ componentTheme . focusOutlineOffset } - ${ componentTheme . focusOutlineWidth } ))`
292301 }
293302 } ,
294303 inset : {
@@ -300,6 +309,9 @@ const getFocusStyles = (props: ViewProps, componentTheme: ViewTheme) => {
300309 } ,
301310 'focusRing--radiusLarge' : {
302311 borderRadius : `calc(${ componentTheme . borderRadiusLarge } - (${ componentTheme . focusOutlineInset } + ${ componentTheme . focusOutlineWidth } ))`
312+ } ,
313+ 'focusRing--radiusCustom' : {
314+ borderRadius : `calc(${ focusRingBorderRadius } - (${ componentTheme . focusOutlineOffset } + ${ componentTheme . focusOutlineWidth } ))`
303315 }
304316 }
305317 }
0 commit comments