diff --git a/package.json b/package.json index ef5da05..5e77edf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@observation.org/react-native-components", - "version": "1.47.0", + "version": "1.48.0", "main": "src/index.ts", "repository": "git@github.com:observation/react-native-components.git", "author": "Observation.org", diff --git a/src/components/LargeButton.tsx b/src/components/LargeButton.tsx index fda79fc..08d9374 100644 --- a/src/components/LargeButton.tsx +++ b/src/components/LargeButton.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { StyleProp, StyleSheet, Text, TouchableOpacity, View, ViewStyle } from 'react-native' +import { StyleProp, StyleSheet, Text, TextStyle, TouchableOpacity, View, ViewStyle } from 'react-native' import { Icon } from './Icon' import { IconName } from '../lib/Icons' @@ -11,6 +11,7 @@ import theme from '../styles/theme' type LargeButtonProps = { title: string + titleStyle?: StyleProp onPress?: () => void onPressIn?: () => void iconName?: IconName @@ -52,6 +53,7 @@ const LargeButton = ({ danger, style, title, + titleStyle, iconName, onPress, onPressIn, @@ -74,7 +76,7 @@ const LargeButton = ({ )} - {title} + {title} ) diff --git a/src/components/__tests__/LargeButton.test.tsx b/src/components/__tests__/LargeButton.test.tsx index 937682e..e8575be 100644 --- a/src/components/__tests__/LargeButton.test.tsx +++ b/src/components/__tests__/LargeButton.test.tsx @@ -2,6 +2,7 @@ import React from 'react' import { fireEvent, render } from '@testing-library/react-native' +import appTextStyle from '../../styles/text' import LargeButton from '../LargeButton' const onPress = jest.fn() @@ -52,6 +53,19 @@ describe('LargeButton', () => { expect(toJSON()).toMatchSnapshot() }) + test('Rendering, with title style', () => { + const { toJSON } = render( + , + ) + expect(toJSON()).toMatchSnapshot() + }) + test('Click', async () => { const { getByTestId } = render() await fireEvent.press(getByTestId('touchable-opacity')) diff --git a/src/components/__tests__/__snapshots__/LargeButton.test.tsx.snap b/src/components/__tests__/__snapshots__/LargeButton.test.tsx.snap index c6f470d..10034d1 100644 --- a/src/components/__tests__/__snapshots__/LargeButton.test.tsx.snap +++ b/src/components/__tests__/__snapshots__/LargeButton.test.tsx.snap @@ -64,6 +64,7 @@ exports[`LargeButton Rendering, disabled, primary 1`] = ` "lineHeight": 20, "textAlignVertical": "center", }, + undefined, { "color": "#FFFFFF", }, @@ -142,6 +143,7 @@ exports[`LargeButton Rendering, disabled, secondary 1`] = ` "lineHeight": 20, "textAlignVertical": "center", }, + undefined, { "color": "#E6E6E6", }, @@ -218,6 +220,7 @@ exports[`LargeButton Rendering, enabled, primary 1`] = ` "lineHeight": 20, "textAlignVertical": "center", }, + undefined, { "color": "#FFFFFF", }, @@ -296,6 +299,7 @@ exports[`LargeButton Rendering, enabled, secondary 1`] = ` "lineHeight": 20, "textAlignVertical": "center", }, + undefined, { "color": "#0066B1", }, @@ -372,6 +376,7 @@ exports[`LargeButton Rendering, primary, danger 1`] = ` "lineHeight": 20, "textAlignVertical": "center", }, + undefined, { "color": "#FFFFFF", }, @@ -450,6 +455,7 @@ exports[`LargeButton Rendering, secondary, danger 1`] = ` "lineHeight": 20, "textAlignVertical": "center", }, + undefined, { "color": "#EA554B", }, @@ -526,6 +532,7 @@ exports[`LargeButton Rendering, secondary, danger, disabled => defaults to prima "lineHeight": 20, "textAlignVertical": "center", }, + undefined, { "color": "#FFFFFF", }, @@ -617,6 +624,106 @@ exports[`LargeButton Rendering, with icon 1`] = ` "lineHeight": 20, "textAlignVertical": "center", }, + undefined, + { + "color": "#FFFFFF", + }, + ] + } + > + Press me + + + +`; + +exports[`LargeButton Rendering, with title style 1`] = ` + + + + + +