fix for reset on orientation change

This commit is contained in:
balzack 2023-03-04 18:09:51 -08:00
parent d21d7de58a
commit b4b144383c
3 changed files with 123 additions and 122 deletions

View File

@ -34,20 +34,14 @@ const CardDrawer = createDrawerNavigator();
const RegistryDrawer = createDrawerNavigator();
const Tab = createBottomTabNavigator();
export function Session() {
const { state, actions } = useSession();
const drawerParams = { drawerPosition: 'right', headerShown: false, swipeEnabled: false, drawerType: 'front' };
function ConversationStackScreen() {
const stackParams = { headerStyle: { backgroundColor: Colors.titleBackground }, headerBackTitleVisible: false };
const screenParams = { headerShown: true, headerTintColor: Colors.primary };
const ConversationStackScreen = () => {
const conversation = useContext(ConversationContext);
const [cardId, setCardId] = useState();
const [channelId, setChannelId] = useState();
console.log("REnDER CONVERSATION STACK");
const openConversation = (navigation, card, channel) => {
(async () => {
conversation.actions.setConversation(card, channel);
@ -93,9 +87,12 @@ console.log("REnDER CONVERSATION STACK");
</ConversationStack.Navigator>
</SafeAreaView>
);
}
}
function ProfileStackScreen() {
const stackParams = { headerStyle: { backgroundColor: Colors.titleBackground }, headerBackTitleVisible: false };
const screenParams = { headerShown: true, headerTintColor: Colors.primary };
const ProfileStackScreen = () => {
return (
<SafeAreaView edges={['left', 'right']} style={styles.body}>
<ProfileStack.Navigator screenOptions={({ route }) => (screenParams)}>
@ -105,9 +102,12 @@ console.log("REnDER CONVERSATION STACK");
</ProfileStack.Navigator>
</SafeAreaView>
);
}
}
function ContactStackScreen() {
const stackParams = { headerStyle: { backgroundColor: Colors.titleBackground }, headerBackTitleVisible: false };
const screenParams = { headerShown: true, headerTintColor: Colors.primary };
const ContactStackScreen = () => {
const profile = useContext(ProfileContext);
const [contact, setContact] = useState(null);
@ -155,7 +155,13 @@ console.log("REnDER CONVERSATION STACK");
</ContactStack.Navigator>
</SafeAreaView>
);
}
}
export function Session() {
const { state, actions } = useSession();
const drawerParams = { drawerPosition: 'right', headerShown: false, swipeEnabled: false, drawerType: 'front' };
const HomeScreen = ({ navParams }) => {
@ -304,8 +310,6 @@ console.log("REnDER CONVERSATION STACK");
);
}
console.log("RENDER ROOT", state.tabbed);
return (
<NavigationContainer>
<View style={styles.body}>

View File

@ -49,7 +49,6 @@ export function Conversation({ navigation, cardId, channelId, closeConversation,
}, [navigation, state.subject, state.loaded]);
useEffect(() => {
console.log("RESET CONVERSATION!");
return () => { closeConversation(); };
}, []);

View File

@ -38,12 +38,10 @@ export function useSession() {
if (dimensions.width > config.tabbedWidth) {
const width = Math.floor((dimensions.width * 33) / 100);
tabbed.current = false;
console.log("SET TABBED: false");
updateState({ tabbed: false, baseWidth: width + 50, subWidth: width });
}
else {
tabbed.current = true;
console.log("SET TABBED: true");
updateState({ tabbed: true });
}
}