roko-date-picker
Version:
A simple single/multi date picker
57 lines (56 loc) • 2.24 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_native_1 = require("react-native");
const react_1 = __importStar(require("react"));
const date_fns_1 = require("date-fns");
const constants_1 = require("../../../../../features/domain/constants");
const hooks_1 = require("../../../../../features/hooks");
const SIZE = constants_1.sizes.tiny;
const TodayIndicator = ({ selected, item }) => {
// #region Members
const { theme } = (0, hooks_1.useMain)();
// #endregion
// #region Variables
const customStyle = (0, hooks_1.useStyles)(styles, theme);
// #endregion
// #region Action
if (!(0, date_fns_1.isToday)(item))
return null;
// #endregion
return <react_native_1.View style={[customStyle.root, selected && customStyle.selectedBackground]}/>;
};
exports.default = (0, react_1.memo)(TodayIndicator);
const styles = (theme) => react_native_1.StyleSheet.create({
root: {
height: SIZE,
width: SIZE,
borderRadius: SIZE / 2,
backgroundColor: theme.colors.onSecondary,
position: "absolute",
bottom: 3,
},
selectedBackground: { backgroundColor: theme.colors.background },
});