Created
December 24, 2021 05:17
-
-
Save faustoct1/8c405d2c50a37bce6972827b937b3031 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Views.js | |
````` | |
import React from 'react' | |
import { NavigationContainer } from '@react-navigation/native' | |
import { createNativeStackNavigator } from '@react-navigation/native-stack' | |
const Stack = createNativeStackNavigator(); | |
const options = (route,params) => { | |
return {} | |
} | |
export default Views = () => { | |
const navigationRef = React.useRef(null); | |
return ( | |
<NavigationContainer ref={navigationRef}> | |
<Stack.Navigator> | |
<Stack.Group> | |
<Stack.Screen name="Tabs" component={Tabs} options={{ headerShown: false }}/> | |
<Stack.Screen name="Profile" component={Profile} options={({ route }) => options(route)}/> | |
<Stack.Screen name="Home" component={ProfileForm} options={({ route }) => options(route)}/> | |
</Stack.Group> | |
</Stack.Navigator> | |
</NavigationContainer> | |
) | |
} | |
````` | |
Tabs.js | |
````` | |
import React from 'react' | |
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs' | |
const Tab = createBottomTabNavigator() | |
const options = { | |
headerStyle: {backgroundColor: '#000'}, | |
headerTintColor: '#fff', | |
headerTitleStyle: { | |
fontWeight: 'bold', | |
} | |
} | |
export default Tabs = (props) => { | |
return ( | |
<Tab.Navigator tabBar={props => <TabBar {...props} />}> | |
<Tab.Screen name="View1" component={View1} options={options}/> | |
</Tab.Navigator> | |
) | |
} | |
````` | |
View1.js | |
````` | |
import React from 'react' | |
export default View = (props) => { | |
//BUG happens here | |
console.log(props) | |
return null | |
} | |
````` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment