diff --git a/lib/Mock/Components/NavigationButton.tsx b/lib/Mock/Components/NavigationButton.tsx index b91d67a11eb..06d80162b83 100644 --- a/lib/Mock/Components/NavigationButton.tsx +++ b/lib/Mock/Components/NavigationButton.tsx @@ -32,10 +32,14 @@ export const NavigationButton = class extends Component { renderButtonComponent() { const { button, componentId } = this.props; - //@ts-ignore + // @ts-ignore const buttonComponentId = button.component!.componentId; - //@ts-ignore - const Component = Navigation.mock.store.getComponentClassForName(button.component.name)!(); + // @ts-ignore + const ComponentClass = Navigation.mock.store.getComponentClassForName(button.component.name); + if (!ComponentClass) { + throw new Error(`Cannot find registered component for: ${button.component?.name}`); + } + const ButtonComponent = ComponentClass(); const props = Navigation.mock.store.getPropsForId(buttonComponentId); return ( { }} testID={button.testID} > -