File tree Expand file tree Collapse file tree 5 files changed +9
-5
lines changed Expand file tree Collapse file tree 5 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 11module . exports = {
22 // https://github.com/testing-library/jest-native/issues/46#issuecomment-748674706
33 setupFilesAfterEnv : [ '<rootDir>/test/setup.ts' ] ,
4+ globals : {
5+ __DEV__ : 'development' ,
6+ } ,
47} ;
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export type WizardValues = {
3434 isFirstStep : boolean ;
3535 /** Indicate if the current step is the last step (aka no next step) */
3636 isLastStep : boolean ;
37- } | null ;
37+ } ;
3838
3939/** Console log levels */
4040export type LogLevel = 'info' | 'error' | 'warn' ;
Original file line number Diff line number Diff line change 11import * as React from 'react' ;
22
3+ import { WizardValues } from './types' ;
34import WizardContext from './wizardContext' ;
45
56const useWizard = ( ) => {
@@ -8,7 +9,7 @@ const useWizard = () => {
89 if ( ! context && __DEV__ ) {
910 throw Error ( 'Wrap your step with `Wizard`' ) ;
1011 } else {
11- return context ;
12+ return context as WizardValues ;
1213 }
1314} ;
1415
Original file line number Diff line number Diff line change @@ -79,11 +79,11 @@ const Wizard: React.FC<WizardProps> = React.memo(
7979 logger . log ( 'warn' , 'An invalid startIndex is passed to <Wizard>' ) ;
8080 }
8181 // Invalid header element
82- if ( ! React . isValidElement ( header ) ) {
82+ if ( header && ! React . isValidElement ( header ) ) {
8383 logger . log ( 'error' , 'Invalid header passed to <Wizard>' ) ;
8484 }
8585 // Invalid footer element
86- if ( ! React . isValidElement ( footer ) ) {
86+ if ( footer && ! React . isValidElement ( footer ) ) {
8787 logger . log ( 'error' , 'Invalid footer passed to <Wizard>' ) ;
8888 }
8989 }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import * as React from 'react';
22
33import { WizardValues } from './types' ;
44
5- const WizardContext = React . createContext < WizardValues > ( null ) ;
5+ const WizardContext = React . createContext < WizardValues | null > ( null ) ;
66WizardContext . displayName = 'WizardContext' ;
77
88export default WizardContext ;
You can’t perform that action at this time.
0 commit comments