Skip to content

Commit 5ebc77b

Browse files
committed
bugfix component render support
1 parent 8abc864 commit 5ebc77b

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

components/Swiper.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,10 @@ export default function Swiper({style, data, isStaticPills, initialScrollIndex,
4545
offset: width * index,
4646
index,
4747
});
48-
const renderItem = ({item, index}) => (
48+
const renderItem = ({item: {component: Component, props = {}}, index}) => (
4949
<View style={{width}}>
50-
{typeof item.component !== 'function' && item.component}
51-
{typeof item.component === 'function' && item.component({
52-
index,
53-
...(item.props || {}),
54-
})}
50+
{typeof Component !== 'function' && Component}
51+
{typeof Component === 'function' && <Component {...props} index={index}/>}
5552
</View>
5653
);
5754

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-screens-swiper",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "This lib. provide swiper view functionality with tab navigation on the top.",
55
"main": "index.js",
66
"repository": {

0 commit comments

Comments
 (0)