https://github.com/GeekyAnts/NativeBase/blob/master/Components/Widgets/ListItem.js#L181
It seems like the widgets do no support null or undefined children, how can I bypass this error/bug?
<List
dataArray={notifications}
renderRow={(item) =>
<ListItem>
{ item.avatar && <Thumbnail size={30} source={item.avatar} /> } // Error Here
<Text>{`${item.message}`}</Text>
</ListItem>
}
/>
We will fix this in the next version. Until then you can use this workaround
<ListItem>
{ item.avatar ? <Thumbnail size={30} source={item.avatar} /> : <Text /> }
<Text>{`${item.message}`}</Text>
</ListItem>
Fixed in v0.5.13
I think I have similar issue, event I updated to 0.5.13:
Cannot read property 'type' of null
on:
<View>
<FontAwesomeIcon name="circle" style={iconStyles} /> // here
<Text>{alert.message}</Text>
</View>
File CardItem.js Line: 114:
imagePresent() {
var imagePresent = false;
React.Children.forEach(this.props.children, function (child) {
if(child.type == Image) // <---- here
imagePresent = true;
})
return imagePresent;
}
cc @himanshu-satija
same issue in button
React.Children.map(this.props.children, child => child.type === Text ? React.cloneElement(child, { capitalize: true, ...child.props }) : child);
should be
React.Children.map(this.props.children, child && child => child.type === Text ? React.cloneElement(child, { capitalize: true, ...child.props }) : child);
+1 have the same issue with Button and an empty Text tag gives another error on Android when it tries to capitalize the text. Using an empty View tag as a workaround for now until fixed.