diff --git a/README.md b/README.md index 413bacd2..469d2fc0 100644 --- a/README.md +++ b/README.md @@ -276,6 +276,8 @@ copilot({ })(RootComponent); ``` +`verticalOffset` supports constant values, promises and functions as valid arguments + ### Triggering the tutorial Use `this.props.start()` in the root component in order to trigger the tutorial. You can either invoke it with a touch event or in `componentDidMount`. Note that the component and all its descendants must be mounted before starting the tutorial since the `CopilotStep`s need to be registered first. diff --git a/src/hocs/copilot.js b/src/hocs/copilot.js index 5ee83ad2..c5ffdb8b 100644 --- a/src/hocs/copilot.js +++ b/src/hocs/copilot.js @@ -180,7 +180,7 @@ const copilot = ({ async moveToCurrentStep(): void { const size = await this.state.currentStep.target.measure(); - + if (typeof verticalOffset === "function") verticalOffset = await verticalOffset(); await this.modal.animateMove({ width: size.width + OFFSET_WIDTH, height: size.height + OFFSET_WIDTH,