Skip to content

Conversation

@cixio
Copy link
Contributor

@cixio cixio commented Jun 8, 2024

adding separatorBackgroundColor to Section - this is a workaround for #784

@cixio cixio closed this Jun 8, 2024
@cixio
Copy link
Contributor Author

cixio commented Jun 9, 2024

fixed bug

@cixio cixio reopened this Jun 9, 2024
@Purii
Copy link
Owner

Purii commented Jun 10, 2024

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?

@cixio
Copy link
Contributor Author

cixio commented Jun 10, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants