Created
December 24, 2020 02:02
-
-
Save aranda-adapptor/766381e1b477850540893eec0b9f4d20 to your computer and use it in GitHub Desktop.
Starfield In Reanimated 2 blog post - initial App.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { View } from "react-native"; | |
// Props type for the star | |
interface StarProps { | |
x: number; | |
y: number; | |
} | |
// Star component | |
const Star: React.FC<StarProps> = (props) => { | |
return ( | |
<View | |
style={{ | |
left: props.x, | |
top: props.y, | |
width: 10, | |
height: 10, | |
backgroundColor: "white", | |
}} | |
/> | |
); | |
}; | |
// Starfield app component | |
const Starfield: React.FC<{}> = () => { | |
return ( | |
<View | |
style={{ | |
flex: 1, | |
backgroundColor: "black", | |
}} | |
> | |
<Star x={100} y={100} /> | |
</View> | |
); | |
}; | |
export default Starfield; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment