Trying to create a body structure on my React Native app using images as buttons.
I get hit with an error "Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: number." at this particular segment.
PointsHistory.tsx:
import Buttonicon from "../assets/buttonicon.svg";
<Buttonicon
style={[styles.buttonicon, styles.icon25Layout]}
width={24}
height={24}
>
What am I doing wrong here?
Trying to create a body structure on my React Native app using images as buttons.
I get hit with an error "Warning: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: number." at this particular segment.
PointsHistory.tsx:
import Buttonicon from "../assets/buttonicon.svg";
<Buttonicon
style={[styles.buttonicon, styles.icon25Layout]}
width={24}
height={24}
>
What am I doing wrong here?
Share Improve this question asked Mar 6 at 7:31 Udhayan NairUdhayan Nair 4702 gold badges8 silver badges25 bronze badges1 Answer
Reset to default 0You can use image component for svg image display , but it will only work for iOS .
import { Image } from 'react-native';
const App = () => {
return (
<Image source={require('./assets/image.svg')} style={{ width: 100, height: 100 }} />
);
};
If you want to support both platform react-native-svg is the best choice
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744991882a4604956.html
评论列表(0条)