Skip to content

Instantly share code, notes, and snippets.

@skiph

skiph/ShapeView.js

Created Apr 27, 2018
Embed
What would you like to do?
RNDemo - shapes component
import React from "react";
import { View, Image, Text, StyleSheet } from "react-native";
const shapeView = (props) => {
const imgSrc = {
'logo': require('./assets/approov_largelogo.png'),
'hello': require('./assets/hello.png'),
'confused': require('./assets/confused.png'),
'Rectangle': require('./assets/rectangle.png'),
'Square': require('./assets/square.png'),
'Triangle': require('./assets/triangle.png'),
'Circle': require('./assets/circle.png')
};
return (
<View style={props.style}>
<Image source={imgSrc[props.shape]} style={styles.shapeImg} />
<Text style={{fontSize: 24, marginTop: 10}}>{props.status}</Text>
</View>
);
}
const styles = StyleSheet.create({
shapeImg: {
resizeMode: 'contain',
height: 256,
width: 256
}
});
export default shapeView;
// end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment