Skip to content

Instantly share code, notes, and snippets.

@faustoct1
Created December 24, 2021 05:17
Show Gist options
  • Save faustoct1/8c405d2c50a37bce6972827b937b3031 to your computer and use it in GitHub Desktop.
Save faustoct1/8c405d2c50a37bce6972827b937b3031 to your computer and use it in GitHub Desktop.
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