manuthecoder-react-native-spotlight-tour
Version:
React Native library to implement a highly customizable app tour feature with an awesome spotlight effect
40 lines • 943 B
JavaScript
import { createContext, useContext } from "react";
export const ZERO_SPOT = {
height: 0,
width: 0,
x: 0,
y: 0,
};
export const SpotlightTourContext = createContext({
changeSpot: () => undefined,
goTo: () => undefined,
next: () => undefined,
pause: () => undefined,
previous: () => undefined,
resume: () => undefined,
spot: ZERO_SPOT,
start: () => undefined,
status: "idle",
steps: [],
stop: () => undefined,
});
/**
* React hook to access the {@link SpotlightTour} context.
*
* @returns the SpotlightTour context
*/
export function useSpotlightTour() {
const { current, goTo, next, pause, previous, resume, start, status, stop } = useContext(SpotlightTourContext);
return {
current,
goTo,
next,
pause,
previous,
resume,
start,
status,
stop,
};
}
//# sourceMappingURL=SpotlightTour.context.js.map