Skip to content

Commit e5fc6d7

Browse files
committed
fix regular functions not being rendered
1 parent 05f5229 commit e5fc6d7

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

components/Swiper.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {useWindowDimensions, FlatList, ScrollView, Text, TouchableOpacity, View}
33
import StaticPills from "./StaticPills";
44
import {usePrevious} from "../helpers/usePrevious";
55

6-
const isJSX = element => typeof element?.type === 'object';
7-
const isMemo = element => typeof element?.type === 'function';
6+
const isJSX = element => typeof element !== 'function' && typeof element?.type === 'object';
7+
const isMemo = element => typeof element !== 'function' && typeof element?.type === 'function';
88

99
export default function Swiper({style, data, isStaticPills, initialScrollIndex, ...rest}) {
1010
const width = useWindowDimensions().width;
@@ -50,8 +50,8 @@ export default function Swiper({style, data, isStaticPills, initialScrollIndex,
5050
});
5151
const renderItem = ({item: {component: Component, props = {}}, index}) => (
5252
<View style={{width}}>
53-
{typeof Component !== 'function' && isJSX(Component) && Component}
54-
{typeof Component === 'function' || (typeof Component !== 'function' && isMemo(Component)) && <Component {...props} index={index}/>}
53+
{isJSX(Component) && Component}
54+
{(typeof Component === 'function' || isMemo(Component)) && <Component {...props} index={index}/>}
5555
</View>
5656
);
5757

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.2",
3+
"version": "1.1.3",
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)