Skip to content

Instantly share code, notes, and snippets.

@shawn-kb
Created November 18, 2017 03:16
Show Gist options
  • Select an option

  • Save shawn-kb/ee24d5dad7df0ffbf2586f02a38f20f9 to your computer and use it in GitHub Desktop.

Select an option

Save shawn-kb/ee24d5dad7df0ffbf2586f02a38f20f9 to your computer and use it in GitHub Desktop.
not getting the props
App.js | n/RootNavigation.js | n/MainTabNavigator.js s/SettingsScreen.js s/SystemStore.js | s/SummaryScreen.js | buffers
import React from 'react';
import {Text, Button, Alert, StyleSheet, View } from 'react-native';
// Mobx state stores
import { inject, observer, Provider } from 'mobx-react';
import { observable, action } from "mobx";
import stores from '../stores/stores';
export default class SettingsScreen extends React.Component {
constructor(props) {
super(props);
console.log("super props")
console.log(props)
}
static navigationOptions = {
title: 'profile',
};
_clearAllStores(){
console.log("Clearing Stores");
stores.systemStore.loggedIn = false;
stores.systemStore.controlAuth = false;
stores.systemStore.testingKey = "Testing-Yo";
stores.systemStore.activeGroupId = 0;
stores.systemStore.activeGroup = {};
stores.systemStore.activeLogin = "";
stores.systemStore.activePassword = "";
console.log("loggin props ")
console.log(this.props);
this.props.navigation.navigate("Login")
}
render() {
return (
<View>
<Text>Clear all info (will redirect to new login)</Text>
<Button
onPress = {this._clearAllStores }
title = "Clear Now"
/>
</View>
)
}
}
~
import { Ionicons } from '@expo/vector-icons';
import { TabNavigator, TabBarTop } from 'react-navigation';
import SummaryScreen from '../screens/SummaryScreen';
import SelectGroupScreen from '../screens/SelectGroupScreen';
import LinksScreen from '../screens/LinksScreen';
import SettingsScreen from '../screens/SettingsScreen';
export default TabNavigator(
{
Summary: {
screen: SummaryScreen,
},
SelectGroup: {
screen: SelectGroupScreen,
},
Settings: {
screen: SettingsScreen,
},
},
{
navigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused }) => {
const { routeName } = navigation.state;
let iconName;
switch (routeName) {
case 'Summary':
iconName = Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-information-circle';
break;
case 'SelectGroup':
iconName = Platform.OS === 'ios'
? `ios-link${focused ? '' : '-outline'}`
: 'md-link';
break;
case 'Settings':
iconName = Platform.OS === 'ios'
? `ios-options${focused ? '' : '-outline'}`
: 'md-options';
}
return (
<Ionicons
name={iconName}
size={28}
style={{ marginBottom: -3 }}
color={focused ? Colors.tabIconSelected : Colors.tabIconDefault}
/>
);
},
}),
tabBarComponent: TabBarTop,
tabBarPosition: 'bottom',
animationEnabled: false,
swipeEnabled: false,
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment