Reputation: 27
Card component from shards-react isn't working
When I run react-native run-android
I get an Error:
View config not found for name div.Help please thanks.
import React from "react";
import PropTypes from "prop-types";
import { StyleSheet, Text, View, Alert, Image } from 'react-native';
import { Card } from "shards-react";
class User extends React.Component {
render() {
const { name, avatar, email} = this.props;
const userDetails = (
<View>
<Image style={styles.img} source={require('../assets/logo.jpg')} />
<Text>Name: {name} </Text>
<Text>Email: {email} </Text>
</View>
);
return (
<Card>
{userDetails}
</Card>
);
}
}
const styles = StyleSheet.create({
img:{
marginTop:250,
height:120,
width: 120,
borderRadius: 70,
}
});
User.propTypes = {
name: PropTypes.string,
avatar: PropTypes.string,
email: PropTypes.string,
isLoading: PropTypes.bool
};
export default User;
Is this library work only for web ? Not for mobile apps ?
If yes is there another one ?
Upvotes: 1
Views: 62
Reputation: 5179
shards-react
by default uses <div>
tag for building Cards. <div>
is an invalid React Native Component. But shards-react
allows passing other components to use instead of <div>
. Try to pass tag
prop to Card
like this:
return (
<Card tag={View}>
{userDetails}
</Card>
);
If this won't help you, then this library cannot be used in react-native
.
Upvotes: 2