UNPKG

react-native-tableview-simple

Version:

React Native component for TableView made with pure CSS

29 lines 1.13 kB
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 (<ThemeContext.Provider value={themeMode}> <View style={[styles.tableView, style]}>{children}</View> </ThemeContext.Provider>); }; const styles = StyleSheet.create({ tableView: { flexDirection: 'column', }, }); export default TableView; //# sourceMappingURL=TableView.js.map