react-native-tableview-simple icon indicating copy to clipboard operation
react-native-tableview-simple copied to clipboard

add separatorBackgroundColor to Section

Open cixio opened this issue 1 year ago • 3 comments

adding separatorBackgroundColor to Section - this is a workaround for https://github.com/Purii/react-native-tableview-simple/issues/784

cixio avatar Jun 08 '24 15:06 cixio

fixed bug

cixio avatar Jun 09 '24 18:06 cixio

Hi @cixio, thanks for the PR. As you point out, this is just a workaround. The same issue happens with other props, like hideSeparator, as you mention in #784 . From what you report, I don't see any hard requirement, why you would introduce another react component as layer in between Section and Cell. Therefor I suggest to follow this approach:

https://github.com/Purii/react-native-tableview-simple?tab=readme-ov-file#override-defaults-of-cell-component

Is there anything that speaks against this approach from your point of view?

Purii avatar Jun 10 '24 15:06 Purii

Hi, yes, I use this as workaround, but its also a new feature. :)

The soluton with the cellPropsCustom is a point, but thats also just a workaround as I think the best solution to use custom settings is this:

import { TableView as TV, Section as S, Cell as C, Separator as Sep } from 'react-native-tableview-simple';

const TableView = (props) => { 
	return (
		<TV
			appearance={'dark'}
			style={ {marginHorizontal: 15} }
			{...props}
		/>
	);
}

const Section = (props) => {
	return ( 
		<S
			allowFontScaling={false}
			hideSurroundingSeparators={true}
			roundedCorners={true}
			{...props} 
		/> 
	);
}

[...]

export {TableView, Section, Cell, Separator};

So you only have to include this file on every page:

import { TableView, Section, Cell, Separator } from './myTableView';

And you can use tableview on multiple page without adding custom settings on every line.

The problem is that using this way makes some issues like the separator backgroundcolor and hideSeparator.

cixio avatar Jun 10 '24 22:06 cixio