react-native-tableview-simple
Version:
React Native component for TableView made with pure CSS
34 lines • 1.44 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 = 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 (<Theme_1.ThemeContext.Provider value={themeMode}>
<react_native_1.View style={[styles.tableView, style]}>{children}</react_native_1.View>
</Theme_1.ThemeContext.Provider>);
};
const styles = react_native_1.StyleSheet.create({
tableView: {
flexDirection: 'column',
},
});
exports.default = TableView;
//# sourceMappingURL=TableView.js.map