Skip to content

Instantly share code, notes, and snippets.

@aranda-adapptor
Created December 24, 2020 02:02
Show Gist options
  • Save aranda-adapptor/766381e1b477850540893eec0b9f4d20 to your computer and use it in GitHub Desktop.
Save aranda-adapptor/766381e1b477850540893eec0b9f4d20 to your computer and use it in GitHub Desktop.
Starfield In Reanimated 2 blog post - initial App.tsx
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