From e3f7ad6c7a6e64192cda829b636515614fc04441 Mon Sep 17 00:00:00 2001 From: Bruno Castro Date: Tue, 18 Oct 2022 17:05:58 -0300 Subject: [PATCH] refactor: make Banner actions optional (#3416) --- src/components/Banner.tsx | 4 ++-- src/components/__tests__/Banner.test.js | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/Banner.tsx b/src/components/Banner.tsx index 90b4361da6..15e6a8826a 100644 --- a/src/components/Banner.tsx +++ b/src/components/Banner.tsx @@ -32,7 +32,7 @@ export type Props = $RemoveChildren & { * * To customize button you can pass other props that button component takes. */ - actions: Array< + actions?: Array< { label: string; } & Omit, 'children'> @@ -128,7 +128,7 @@ const Banner = ({ visible, icon, children, - actions, + actions = [], contentStyle, elevation = 1, style, diff --git a/src/components/__tests__/Banner.test.js b/src/components/__tests__/Banner.test.js index ed4a1430a9..a915514d62 100644 --- a/src/components/__tests__/Banner.test.js +++ b/src/components/__tests__/Banner.test.js @@ -8,7 +8,7 @@ import Banner from '../Banner.tsx'; it('renders hidden banner, without action buttons and without image', () => { const tree = renderer .create( - + Two line text string with two actions. One to two lines is preferable on mobile. @@ -21,7 +21,7 @@ it('renders hidden banner, without action buttons and without image', () => { it('renders visible banner, without action buttons and without image', () => { const tree = renderer .create( - + Two line text string with two actions. One to two lines is preferable on mobile. @@ -62,7 +62,6 @@ it('renders visible banner, without action buttons and with image', () => { accessibilityIgnoresInvertColors /> )} - actions={[]} > Two line text string with two actions. One to two lines is preferable on mobile.