Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verticalOffset function support #106 #177

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/hocs/copilot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down