Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions example/src/views/dialogs.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import React, { useState } from 'react';
import { Button, Dialog, CheckBox, ListItem, Avatar } from '@rneui/themed';
import { View, Text, StyleSheet } from 'react-native';
import {
Button,
Dialog,
CheckBox,
ListItem,
Avatar,
Text,
} from '@rneui/themed';
import { View, StyleSheet } from 'react-native';
import { Header } from '../components/header';

type DialogComponentProps = {};
Expand Down Expand Up @@ -118,7 +125,7 @@ const Dialogs: React.FunctionComponent<DialogComponentProps> = () => {
<CheckBox
key={i}
title={l}
containerStyle={{ backgroundColor: 'white', borderWidth: 0 }}
containerStyle={{ borderWidth: 0 }}
checkedIcon="dot-circle-o"
uncheckedIcon="circle-o"
checked={checked === i + 1}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"scripts": {
"build": "lerna run build",
"build:docs-api": "yarn workspace @rneui/doc-gen build",
"clean-build": "rm -rf packages/*/dist",
"clean-build": "rimraf packages/*/dist",
"clean-install": "rimraf node_modules && yarn",
"docs-build-api": "yarn workspace @rneui/doc-gen build",
"docs-build": "yarn docs-build-api && cd website && yarn run build",
Expand Down
8 changes: 5 additions & 3 deletions packages/base/src/Dialog/Dialog.Title.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Text, StyleSheet, TextStyle, StyleProp, Platform } from 'react-native';
import { RneFunctionComponent } from '../helpers';
import { TextProps } from '../Text';
import { StyleSheet, TextStyle, StyleProp, Platform } from 'react-native';
import { defaultTheme, RneFunctionComponent } from '../helpers';
import { TextProps, Text } from '../Text';

export interface DialogTitleProps {
/** Add Dialog title. */
Expand All @@ -19,11 +19,13 @@ export const DialogTitle: RneFunctionComponent<DialogTitleProps> = ({
title,
titleStyle,
titleProps,
theme = defaultTheme,
}) => {
return (
<Text
style={StyleSheet.flatten([styles.title, titleStyle])}
testID="Dialog__Title"
theme={theme}
{...titleProps}
>
{title}
Expand Down
22 changes: 21 additions & 1 deletion packages/themed/src/Dialog/__tests__/Dialog.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Dialog from '..';
import { CreateThemeOptions } from '../..';
import { CreateThemeOptions, darkColors, lightColors } from '../..';
import { renderWithWrapper } from '../../../.ci/testHelper';

describe('Dialog Component', () => {
Expand All @@ -19,4 +19,24 @@ describe('Dialog Component', () => {
);
expect(wrapper.props.transparent).toBeFalsy();
});
it.each`
mode | expectedColor
${'dark'} | ${darkColors.black}
${'light'} | ${lightColors.black}
`('should apply $mode theme mode to Dialog', ({ mode, expectedColor }) => {
const theme: Partial<CreateThemeOptions> = {
lightColors,
darkColors,
mode,
};
const { getByText, toJSON } = renderWithWrapper(
<Dialog isVisible={true}>
<Dialog.Title title={'Unit Test Title'} />
</Dialog>,
'Dialog__Title',
theme
);
const textComponent = getByText('Unit Test Title');
expect(textComponent.props.style.color).toEqual(expectedColor);
});
});