react-native-micro-interactions
Version:
Effortlessly enhance your React Native components with subtle micro-interactions and animations.
59 lines (57 loc) • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useConfig = exports.MintProvider = void 0;
var _react = require("react");
var _defaults = require("../constants/defaults.js");
var _jsxRuntime = require("react/jsx-runtime");
const MintContext = /*#__PURE__*/(0, _react.createContext)((0, _defaults.AnimationConfig)({
"click": {
shrink: 0.9,
shrinkDuration: 50
},
"buzz": {
frequency: 2,
rotation: 2,
duration: 50
},
"popIn": {
duration: 250,
withBounce: true
},
"dropIn": {
duration: 250,
withBounce: true,
damping: 10
},
"textSlideVertical": {
duration: 100,
offset: 30
},
"textSlideHorizontal": {
duration: 100,
offset: 30
}
}));
// export default MintContext.Provider;
const MintProvider = ({
config,
children
}) => {
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MintContext.Provider, {
value: config,
children: children
});
};
exports.MintProvider = MintProvider;
const useConfig = () => {
try {
const ctx = (0, _react.useContext)(MintContext);
return ctx;
} catch (e) {
throw new Error("Please wrap your App in MintProvider!");
}
};
exports.useConfig = useConfig;
//# sourceMappingURL=MintProvider.js.map