react-native-tableview-simple
Version:
React Native component for TableView made with pure CSS
28 lines • 1.14 kB
JavaScript
import React from 'react';
import { useColorScheme, StyleSheet, View, } from 'react-native';
import { THEMES, ThemeContext } from './Theme';
const TableView = ({ children, appearance = 'auto', customAppearances, style, }) => {
let themeMode = THEMES?.appearances?.light;
const systemColorScheme = useColorScheme();
if (appearance === 'auto' &&
(systemColorScheme === 'dark' || systemColorScheme === 'light')) {
themeMode = THEMES?.appearances?.[systemColorScheme];
}
else if (appearance === 'light' || appearance === 'dark') {
themeMode = THEMES?.appearances?.[appearance];
}
else if (customAppearances &&
appearance &&
Object.prototype.hasOwnProperty.call(customAppearances, appearance)) {
themeMode = customAppearances[appearance];
}
return (React.createElement(ThemeContext.Provider, { value: themeMode },
React.createElement(View, { style: [styles.tableView, style] }, children)));
};
const styles = StyleSheet.create({
tableView: {
flexDirection: 'column',
},
});
export default TableView;
//# sourceMappingURL=TableView.js.map