react-native-games
Version:
Free games for your react native projects.
1 lines • 1.92 kB
JavaScript
"use strict";import React from 'react';import{View}from 'react-native';import{jsx as _jsx,jsxs as _jsxs}from "react/jsx-runtime";export const AsteroidComponent = React.memo(({asteroid})=>{return _jsxs(View,{style:{position:'absolute',left:asteroid.x,top:asteroid.y,width:asteroid.width,height:asteroid.height,backgroundColor:'#6B4423',borderRadius:15,shadowColor:'#2F1B14',shadowOffset:{width:3,height:4},shadowOpacity:0.7,shadowRadius:10,borderWidth:1,borderColor:'rgba(139,69,19,0.8)'},children:[_jsx(View,{style:{position:'absolute',left:2,top:2,width:asteroid.width - 4,height:Math.max(0,asteroid.height - 4),backgroundColor:'rgba(160,82,45,0.4)',borderRadius:12}}),_jsx(View,{style:{position:'absolute',left:asteroid.width * 0.25,top:asteroid.height * 0.3,width:12,height:8,backgroundColor:'rgba(47,27,20,0.8)',borderRadius:6}}),_jsx(View,{style:{position:'absolute',left:asteroid.width * 0.65,top:asteroid.height * 0.6,width:8,height:6,backgroundColor:'rgba(47,27,20,0.9)',borderRadius:4}}),_jsx(View,{style:{position:'absolute',left:asteroid.width * 0.15,top:asteroid.height * 0.7,width:5,height:4,backgroundColor:'rgba(47,27,20,0.7)',borderRadius:2}}),_jsx(View,{style:{position:'absolute',left:asteroid.width * 0.45,top:asteroid.height * 0.2,width:4,height:4,backgroundColor:'rgba(101,67,33,0.8)',borderRadius:2}}),_jsx(View,{style:{position:'absolute',left:asteroid.width * 0.8,top:asteroid.height * 0.4,width:3,height:3,backgroundColor:'rgba(139,69,19,0.9)',borderRadius:1.5}}),_jsx(View,{style:{position:'absolute',left:asteroid.width * 0.1,top:asteroid.height * 0.1,width:asteroid.width * 0.3,height:asteroid.height * 0.2,backgroundColor:'rgba(205,133,63,0.3)',borderRadius:8}})]});},(prevProps,nextProps)=>{const prev = prevProps.asteroid;const next = nextProps.asteroid;return prev.id === next.id && prev.x === next.x && prev.y === next.y && prev.width === next.width && prev.height === next.height;});