import { useState , useEffect } from "react" ; import { Dimensions } from "react-native" ; import { StatusBar } from "expo-status-bar" ; import Canvas from "./Canvas" ; export const App = ( ) => { const [ dimensions , setDimensions ] = useState < { width : number ; height : number ; } > ( ( ) => Dimensions . get ( "window" ) ) ; useEffect ( ( ) => { const onChange = ( { window , } ) => { setDimensions ( window ) ; } ; const subscription = Dimensions . addEventListener ( "change" , onChange ) ; return ( ) => { subscription . remove ( ) ; } ; } , [ ] ) ; return ( < > < Canvas width = { dimensions . width } height = { dimensions . height } / > { } < StatusBar style = "dark" / > < />); } ; export default App ;