Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ describe('Hint Screen component test', () => {
expect(driver.getModal().isVisible()).toBe(false);
});

it('Should pass modalProps to the modal', async () => {
const renderTree = render(
<TestCase visible withModal modalProps={{supportedOrientations: ['landscape']}}/>
);

expect(renderTree.getByTestId(`${HINT_TEST_ID}.modal`).props.supportedOrientations).toEqual(['landscape']);
});

// TODO: This scenario tests doesn't pass, need to fix it using act
it.skip('Should modal be visible when showHint is true', async () => {
const renderTree = render(<TestCase visible withModal/>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
"type": "boolean",
"description": "Open the hint using a Modal component"
},
{
"name": "modalProps",
"type": "ModalProps",
"description": "Pass props to the hint modal"
},
{
"name": "useSideTip",
"type": "boolean",
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-ui-lib/src/components/hint/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const Hint = (props: HintProps) => {
const {
visible,
useModal = true,
modalProps,
position = HintPositions.BOTTOM,
children,
message,
Expand Down Expand Up @@ -216,6 +217,7 @@ const Hint = (props: HintProps) => {
{renderChildren()}
{isUsingModal ? (
<Modal
{...modalProps}
visible={showHint}
animationType={backdropColor ? 'fade' : 'none'}
overlayBackgroundColor={backdropColor}
Expand Down
5 changes: 5 additions & 0 deletions packages/react-native-ui-lib/src/components/hint/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
TextStyle,
ViewStyle
} from 'react-native';
import type {ModalProps} from '../modal';

export type PositionStyle = Pick<ViewStyle, 'top' | 'bottom' | 'left' | 'right'>;

Expand Down Expand Up @@ -65,6 +66,10 @@ export interface HintProps {
* Open the hint using a Modal component
*/
useModal?: boolean;
/**
* Additional props for the modal
*/
modalProps?: ModalProps;
/**
* Show side tips instead of the middle tip
*/
Expand Down