Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Styling of labels in FAB.Group #2894

Merged
merged 1 commit into from
Nov 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/components/FAB/FABGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ type Props = {
* - `label`: optional label text
* - `accessibilityLabel`: accessibility label for the action, uses label by default if specified
* - `color`: custom icon color of the action item
* - `labelTextColor`: custom label text color of the action item
* - `style`: pass additional styles for the fab item, for example, `backgroundColor`
* - `labelStyle`: pass additional styles for the fab item label, for example, `backgroundColor`
* - `small`: boolean describing whether small or normal sized FAB is rendered. Defaults to `true`
* - `onPress`: callback that is called when `FAB` is pressed (required)
*/
actions: Array<{
icon: IconSource;
label?: string;
color?: string;
labelTextColor?: string;
accessibilityLabel?: string;
style?: StyleProp<ViewStyle>;
labelStyle?: StyleProp<ViewStyle>;
small?: boolean;
onPress: () => void;
testID?: string;
Expand Down Expand Up @@ -292,6 +296,7 @@ const FABGroup = ({
transform: [{ scale: scales[i] }],
opacity: opacities[i],
},
it.labelStyle,
] as StyleProp<ViewStyle>
}
onPress={() => {
Expand All @@ -308,7 +313,9 @@ const FABGroup = ({
accessibilityComponentType="button"
accessibilityRole="button"
>
<Text style={{ color: labelColor }}>{it.label}</Text>
<Text style={{ color: it.labelTextColor ?? labelColor }}>
{it.label}
</Text>
</Card>
</View>
)}
Expand Down