You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+57-6Lines changed: 57 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,11 +174,13 @@ children | - |
174
174
#### Wrap `Cell`
175
175
176
176
Sometimes custom `Cell` components are needed.
177
-
By creating new component, which is based on `Cell`, its only necessary to set the props once.
177
+
By creating a new component, which is based on `Cell`, its only necessary to set the props once.
178
+
However, this comes with certain downsides. In order to keep the API as easy to use as possible, I implemented some automations for the `Sections` component.
179
+
For example, the `Cell.backgroundColor` prop will also decide on the `backgroundColor` of the `Separator` component.
This pattern introduces an additional layer between `Section` and `Cell`:`Section`->`CellVariant`->`Cell`.
222
+
The `Section` component is expecting a `Cell` component as a child and therefor tries to [access the props as defined for the `Cell` component](https://github.com/Purii/react-native-tableview-simple/blob/5e81f61993eea32784cd9b20fa6e73d1240d77e5/src/components/Section.tsx#L131).
223
+
If following the mentioned pattern, this would fail, because `CellVariant.props` only contains the prop `title`.
224
+
Instead, I recommend to insert your newdefault props as description inthis section: [Override defaults of`Cell`-Component](##override-defaults-of-cell-component).
225
+
226
+
If this is not enough for you, and you still need to have a custom cell component, consider merging both approaches:
0 commit comments