react-native-unity-view
react-native-unity-view copied to clipboard
README example code is not working
The current example code at the end of the readme is not working, I guess because of the extra : null}
.
Anyway, I think the whole code is deprecated with the latest react native version.
This code worked for me:
import * as React from 'react';
import { Button, View, } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
import UnityView from '@asmadsen/react-native-unity-view';
const Stack = createStackNavigator();
function HomeScreen({ navigation }) {
return (
<View>
<UnityView style={{ position: 'absolute', left: 0, right: 0, top: 0, bottom: 0, }} />
</View>
);
}
function App() {
return (
<NavigationContainer>
<Stack.Navigator initialRouteName="Home" screenOptions={{headerShown: false}}>
<Stack.Screen name="HomeScreen" component={HomeScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
export default App;