Skip to content

Commit 4198d23

Browse files
jcurtisgitim
authored andcommitted
Add innerContainerStyle that styles the sortable section and not the header and footer (#92)
ok, thanks for contribution, will release it soon
1 parent 0896a6c commit 4198d23

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ npm i react-native-sortable-list --save
2929
- **order?** (Array) an array of keys from data, the order of keys from the array will be used to initial rows order
3030
- **style?** (Object, Array)
3131
- **contentContainerStyle?** (Object, Array) these styles will be applied to the inner scroll view content container
32+
- **innerContainerStyle?** (Object, Array) these styles will be applied to the inner scroll view content container, excluding the header and footer
3233
- **horizontal?** (boolean) when true, the SortableList's children are arranged horizontally in a row instead of vertically in a column. The default value is false.
3334
- **sortingEnabled?** (boolean) when false, rows are not sortable. The default value is true.
3435
- **scrollEnabled?** (boolean) when false, the content does not scrollable. The default value is true.

src/SortableList.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ uniqueRowKey.id = 0
1515

1616
export default class SortableList extends Component {
1717
static propTypes = {
18-
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
18+
data: PropTypes.oneOfType([PropTypes.array, PropTypes.object]).isRequired,
1919
order: PropTypes.arrayOf(PropTypes.any),
2020
style: ViewPropTypes.style,
2121
contentContainerStyle: ViewPropTypes.style,
22+
innerContainerStyle: ViewPropTypes.style,
2223
sortingEnabled: PropTypes.bool,
2324
scrollEnabled: PropTypes.bool,
2425
horizontal: PropTypes.bool,
@@ -173,12 +174,13 @@ export default class SortableList extends Component {
173174
}
174175

175176
render() {
176-
const {contentContainerStyle, horizontal, style} = this.props;
177+
let {contentContainerStyle, innerContainerStyle, horizontal, style} = this.props;
177178
const {animated, contentHeight, contentWidth, scrollEnabled} = this.state;
178179
const containerStyle = StyleSheet.flatten([style, {opacity: Number(animated)}])
179-
const innerContainerStyle = [
180+
innerContainerStyle = [
180181
styles.rowsContainer,
181182
horizontal ? {width: contentWidth} : {height: contentHeight},
183+
innerContainerStyle
182184
];
183185
let {refreshControl} = this.props;
184186

0 commit comments

Comments
 (0)