@oxyhq/services
Version:
90 lines (89 loc) • 2.53 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactNative = require("react-native");
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* Reusable setting row component with switch
* Extracted from PrivacySettingsScreen for reuse across settings screens
*/
const SettingRow = ({
title,
description,
value,
onValueChange,
disabled = false,
textColor,
mutedTextColor,
borderColor,
activeColor = '#d169e5',
inactiveColor = '#767577',
accessibilityLabel
}) => {
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
style: [styles.settingRow, borderColor ? {
borderBottomColor: borderColor
} : undefined],
accessibilityRole: "none",
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
style: styles.settingInfo,
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
style: [styles.settingTitle, textColor ? {
color: textColor
} : undefined],
accessibilityRole: "text",
children: title
}), description && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
style: [styles.settingDescription, mutedTextColor ? {
color: mutedTextColor
} : undefined],
accessibilityRole: "text",
children: description
})]
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Switch, {
value: value,
onValueChange: onValueChange,
disabled: disabled,
trackColor: {
false: inactiveColor,
true: activeColor
},
thumbColor: value ? '#fff' : '#f4f3f4',
accessibilityRole: "switch",
accessibilityLabel: accessibilityLabel || title,
accessibilityState: {
checked: value,
disabled
},
accessibilityHint: description
})]
});
};
const styles = _reactNative.StyleSheet.create({
settingRow: {
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
paddingVertical: 16,
borderBottomWidth: 1
},
settingInfo: {
flex: 1,
marginRight: 16
},
settingTitle: {
fontSize: 16,
fontWeight: '500',
marginBottom: 4
},
settingDescription: {
fontSize: 14,
opacity: 0.7
}
});
var _default = exports.default = /*#__PURE__*/_react.default.memo(SettingRow);
//# sourceMappingURL=SettingRow.js.map