react-native-tableview-simple
Version:
React Native component for TableView made with pure CSS
33 lines • 1.46 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const react_1 = __importDefault(require("react"));
const react_native_1 = require("react-native");
const Theme_1 = require("./Theme");
const TableView = ({ children, appearance = 'auto', customAppearances, style, }) => {
let themeMode = Theme_1.THEMES?.appearances?.light;
const systemColorScheme = (0, react_native_1.useColorScheme)();
if (appearance === 'auto' &&
(systemColorScheme === 'dark' || systemColorScheme === 'light')) {
themeMode = Theme_1.THEMES?.appearances?.[systemColorScheme];
}
else if (appearance === 'light' || appearance === 'dark') {
themeMode = Theme_1.THEMES?.appearances?.[appearance];
}
else if (customAppearances &&
appearance &&
Object.prototype.hasOwnProperty.call(customAppearances, appearance)) {
themeMode = customAppearances[appearance];
}
return (react_1.default.createElement(Theme_1.ThemeContext.Provider, { value: themeMode },
react_1.default.createElement(react_native_1.View, { style: [styles.tableView, style] }, children)));
};
const styles = react_native_1.StyleSheet.create({
tableView: {
flexDirection: 'column',
},
});
exports.default = TableView;
//# sourceMappingURL=TableView.js.map