diff options
Diffstat (limited to 'src/components/forms')
-rw-r--r-- | src/components/forms/TextField.tsx | 2 | ||||
-rw-r--r-- | src/components/forms/Toggle.tsx | 8 | ||||
-rw-r--r-- | src/components/forms/ToggleButton.tsx | 8 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/components/forms/TextField.tsx b/src/components/forms/TextField.tsx index 1ee58303a..67515049c 100644 --- a/src/components/forms/TextField.tsx +++ b/src/components/forms/TextField.tsx @@ -208,7 +208,7 @@ export function createInput(Component: typeof TextInput) { paddingBottom: 2, }), { - lineHeight: a.text_md.lineHeight * 1.1875, + lineHeight: a.text_md.fontSize * 1.1875, textAlignVertical: rest.multiline ? 'top' : undefined, minHeight: rest.multiline ? 60 : undefined, }, diff --git a/src/components/forms/Toggle.tsx b/src/components/forms/Toggle.tsx index ad82bdff5..d3c034246 100644 --- a/src/components/forms/Toggle.tsx +++ b/src/components/forms/Toggle.tsx @@ -2,7 +2,7 @@ import React from 'react' import {Pressable, View, ViewStyle} from 'react-native' import {HITSLOP_10} from 'lib/constants' -import {useTheme, atoms as a, web, native} from '#/alf' +import {useTheme, atoms as a, web, native, flatten, ViewStyleProp} from '#/alf' import {Text} from '#/components/Typography' import {useInteractionState} from '#/components/hooks/useInteractionState' @@ -49,7 +49,7 @@ export type GroupProps = React.PropsWithChildren<{ label: string }> -export type ItemProps = { +export type ItemProps = ViewStyleProp & { type?: 'radio' | 'checkbox' name: string label: string @@ -57,7 +57,6 @@ export type ItemProps = { disabled?: boolean onChange?: (selected: boolean) => void isInvalid?: boolean - style?: (state: ItemState) => ViewStyle children: ((props: ItemState) => React.ReactNode) | React.ReactNode } @@ -125,6 +124,7 @@ export function Group({ return ( <GroupContext.Provider value={context}> <View + style={[a.w_full]} role={groupRole} {...(groupRole === 'radiogroup' ? { @@ -224,7 +224,7 @@ export function Item({ a.align_center, a.gap_sm, focused ? web({outline: 'none'}) : {}, - style?.(state), + flatten(style), ]}> {typeof children === 'function' ? children(state) : children} </Pressable> diff --git a/src/components/forms/ToggleButton.tsx b/src/components/forms/ToggleButton.tsx index 615fedae8..5cd51d794 100644 --- a/src/components/forms/ToggleButton.tsx +++ b/src/components/forms/ToggleButton.tsx @@ -20,6 +20,7 @@ export function Group({children, multiple, ...props}: GroupProps) { <Toggle.Group type={multiple ? 'checkbox' : 'radio'} {...props}> <View style={[ + a.w_full, a.flex_row, a.border, a.rounded_sm, @@ -34,7 +35,7 @@ export function Group({children, multiple, ...props}: GroupProps) { export function Button({children, ...props}: ItemProps) { return ( - <Toggle.Item {...props}> + <Toggle.Item {...props} style={[a.flex_grow]}> <ButtonInner>{children}</ButtonInner> </Toggle.Item> ) @@ -95,11 +96,12 @@ function ButtonInner({children}: React.PropsWithChildren<{}>) { borderLeftWidth: 1, marginLeft: -1, }, - a.px_lg, + a.flex_grow, a.py_md, native({ - paddingTop: 14, + paddingBottom: 10, }), + a.px_sm, t.atoms.bg, t.atoms.border, baseStyles, |