react-native-timer-picker
Version:
A simple, flexible, performant duration picker for React Native apps 🔥 Great for timers, alarms and duration inputs ⏰🕰️⏳ Includes iOS-style haptic and audio feedback 🍏
38 lines • 1.16 kB
JavaScript
import React from "react";
import { View, Text } from "react-native";
const PickerItem = /*#__PURE__*/React.memo(({
adjustedLimitedMax,
adjustedLimitedMin,
allowFontScaling,
amLabel,
is12HourPicker,
item,
pmLabel,
styles
}) => {
let stringItem = item;
let intItem;
let isAm;
if (!is12HourPicker) {
intItem = parseInt(item);
} else {
isAm = item.includes("AM");
stringItem = item.replace(/\s[AP]M/g, "");
intItem = parseInt(stringItem);
}
return /*#__PURE__*/React.createElement(View, {
key: item,
style: styles.pickerItemContainer,
testID: "picker-item"
}, /*#__PURE__*/React.createElement(Text, {
allowFontScaling: allowFontScaling,
style: [styles.pickerItem, intItem > adjustedLimitedMax || intItem < adjustedLimitedMin ? styles.disabledPickerItem : {}]
}, stringItem), is12HourPicker && /*#__PURE__*/React.createElement(View, {
style: styles.pickerAmPmContainer
}, /*#__PURE__*/React.createElement(Text, {
allowFontScaling: allowFontScaling,
style: styles.pickerAmPmLabel
}, isAm ? amLabel : pmLabel)));
});
export default PickerItem;
//# sourceMappingURL=PickerItem.js.map