@@ -40,7 +40,7 @@ export const EngineView: FunctionComponent<EngineViewProps> = (props: EngineView
4040 const [ appState , setAppState ] = useState ( AppState . currentState ) ;
4141 const [ fps , setFps ] = useState < number > ( ) ;
4242 const engineViewRef = useRef < Component < NativeEngineViewProps > > ( null ) ;
43- const snapshotPromise = useRef < { promise : Promise < string > , resolve : ( data : string ) => void } > ( ) ;
43+ const snapshotPromise = useRef < { promise : Promise < string > , resolve : ( data : string ) => void } > ( ) ;
4444
4545 useEffect ( ( ) => {
4646 ( async ( ) => {
@@ -80,6 +80,8 @@ export const EngineView: FunctionComponent<EngineViewProps> = (props: EngineView
8080 } ;
8181 }
8282 }
83+
84+ return undefined ;
8385 } , [ props . camera , appState ] ) ;
8486
8587 useEffect ( ( ) => {
@@ -99,6 +101,7 @@ export const EngineView: FunctionComponent<EngineViewProps> = (props: EngineView
99101 }
100102
101103 setFps ( undefined ) ;
104+ return undefined ;
102105 } , [ props . camera , props . displayFrameRate ] ) ;
103106
104107 // Call onInitialized if provided, and include the callback for takeSnapshot.
@@ -134,7 +137,8 @@ export const EngineView: FunctionComponent<EngineViewProps> = (props: EngineView
134137
135138 // Handle snapshot data returned.
136139 const snapshotDataReturnedHandler = useCallback ( ( event : SyntheticEvent ) => {
137- const { data } = event . nativeEvent ;
140+ // The nativeEvent is a DOMEvent which doesn't have a typescript definition. Cast it to an Event object with a data property.
141+ const { data } = event . nativeEvent as Event & { data : string } ;
138142 if ( snapshotPromise . current ) {
139143 snapshotPromise . current . resolve ( data ) ;
140144 snapshotPromise . current = undefined ;
@@ -143,9 +147,9 @@ export const EngineView: FunctionComponent<EngineViewProps> = (props: EngineView
143147
144148 if ( ! failedInitialization ) {
145149 return (
146- < View style = { [ props . style , { overflow : "hidden" } ] } >
147- < NativeEngineView ref = { engineViewRef } style = { { flex : 1 } } onSnapshotDataReturned = { snapshotDataReturnedHandler } />
148- { fps && < Text style = { { color : 'yellow' , position : 'absolute' , margin : 10 , right : 0 , top : 0 } } > FPS: { Math . round ( fps ) } </ Text > }
150+ < View style = { [ props . style , { overflow : "hidden" } ] } >
151+ < NativeEngineView ref = { engineViewRef } style = { { flex : 1 } } onSnapshotDataReturned = { snapshotDataReturnedHandler } />
152+ { fps && < Text style = { { color : 'yellow' , position : 'absolute' , margin : 10 , right : 0 , top : 0 } } > FPS: { Math . round ( fps ) } </ Text > }
149153 </ View >
150154 ) ;
151155 } else {
@@ -155,9 +159,9 @@ export const EngineView: FunctionComponent<EngineViewProps> = (props: EngineView
155159 }
156160
157161 return (
158- < View style = { { flex : 1 , justifyContent : 'center' , alignItems : 'center' } } >
159- < Text style = { { fontSize : 24 } } > { message } </ Text >
160- { isRemoteDebuggingEnabled && < Text style = { { fontSize : 12 } } > React Native remote debugging does not work with Babylon Native.</ Text > }
162+ < View style = { { flex : 1 , justifyContent : 'center' , alignItems : 'center' } } >
163+ < Text style = { { fontSize : 24 } } > { message } </ Text >
164+ { isRemoteDebuggingEnabled && < Text style = { { fontSize : 12 } } > React Native remote debugging does not work with Babylon Native.</ Text > }
161165 </ View >
162166 ) ;
163167 }
0 commit comments