diff --git a/app/client/mobile/src/conversation/Conversation.styled.ts b/app/client/mobile/src/conversation/Conversation.styled.ts index f09ab0e7..1797ddd6 100644 --- a/app/client/mobile/src/conversation/Conversation.styled.ts +++ b/app/client/mobile/src/conversation/Conversation.styled.ts @@ -22,7 +22,6 @@ export const styles = StyleSheet.create({ display: 'flex', alignItems: 'center', justifyContent: 'flex-end', - flexDirection: 'row', gap: 4, }, assets: { @@ -110,7 +109,6 @@ export const styles = StyleSheet.create({ }, header: { display: 'flex', - flexDirection: 'row', width: '100%', minWidth: 0, alignItems: 'center', diff --git a/app/client/mobile/src/conversation/Conversation.tsx b/app/client/mobile/src/conversation/Conversation.tsx index 792b6f16..836bda52 100644 --- a/app/client/mobile/src/conversation/Conversation.tsx +++ b/app/client/mobile/src/conversation/Conversation.tsx @@ -26,7 +26,7 @@ export type MediaAsset = { binary?: { label: string, extension: string, data: string } } -export function Conversation({close}: {close: ()=>void}) { +export function Conversation({close, openDetails, wide}: {close: ()=>void, openDetails: ()=>void, wide: boolean}) { const { state, actions } = useConversation(); const [ more, setMore ] = useState(false); const [ alert, setAlert ] = useState(false); @@ -185,8 +185,8 @@ export function Conversation({close}: {close: ()=>void}) { return ( - - + + @@ -203,7 +203,7 @@ export function Conversation({close}: {close: ()=>void}) { { `, ${state.strings.unknownContact} (${state.unknownContacts})` } )} - + { state.detailSet && !state.access && ( )} @@ -217,7 +217,7 @@ export function Conversation({close}: {close: ()=>void}) { )} - {}} /> + diff --git a/app/client/mobile/src/details/Details.styled.ts b/app/client/mobile/src/details/Details.styled.ts new file mode 100644 index 00000000..87aa817e --- /dev/null +++ b/app/client/mobile/src/details/Details.styled.ts @@ -0,0 +1,42 @@ +import {StyleSheet} from 'react-native'; +import { Colors } from '../constants/Colors'; + +export const styles = StyleSheet.create({ + details: { + display: 'flex', + flexDirection: 'column', + alignItems: 'center', + width: '100%', + height: '100%', + }, + header: { + position: 'relative', + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + paddingRight: 8, + paddingLeft: 8, + width: '100%', + zIndex: 1, + height: 48, + }, + title: { + fontSize: 20, + }, + close: { + width: 32, + }, + closeIcon: { + flexShrink: 0, + marginRight: 0, + marginLeft: 0, + marginTop: 0, + marginBottom: 0, + backgroundColor: 'transparent', + }, + divider: { + width: '100%', + height: 2, + }, +}); diff --git a/app/client/mobile/src/details/Details.tsx b/app/client/mobile/src/details/Details.tsx index 10c6fc12..d577ccc7 100644 --- a/app/client/mobile/src/details/Details.tsx +++ b/app/client/mobile/src/details/Details.tsx @@ -1,6 +1,26 @@ import React from 'react'; -import {Text} from 'react-native-paper'; +import { SafeAreaView, View } from 'react-native'; +import {Divider, IconButton, Text} from 'react-native-paper'; +import {styles} from './Details.styled'; +import {useDetails} from './useDetails.hook'; -export function Details() { - return DETAILS; +export function Details({close, closeAll}: {close: ()=>void, closeAll: ()=>void}) { + const { state, actions } = useDetails(); + + return ( + + + {close && ( + + + + )} + { state.strings.details } + {close && ( + + )} + + + + ) } diff --git a/app/client/mobile/src/details/useDetails.hook.ts b/app/client/mobile/src/details/useDetails.hook.ts new file mode 100644 index 00000000..73a96037 --- /dev/null +++ b/app/client/mobile/src/details/useDetails.hook.ts @@ -0,0 +1,19 @@ +import {useState, useContext, useEffect, useRef} from 'react'; +import {DisplayContext} from '../context/DisplayContext'; +import {ContextType} from '../context/ContextType'; + +export function useDetails() { + const display = useContext(DisplayContext) as ContextType; + const [state, setState] = useState({ + strings: display.state.strings, + }); + + const updateState = (value: any) => { + setState(s => ({...s, ...value})); + }; + + const actions = { + }; + + return {state, actions}; +} diff --git a/app/client/mobile/src/registry/Registry.tsx b/app/client/mobile/src/registry/Registry.tsx index 08bba45c..6934b4b3 100644 --- a/app/client/mobile/src/registry/Registry.tsx +++ b/app/client/mobile/src/registry/Registry.tsx @@ -6,7 +6,7 @@ import {styles} from './Registry.styled'; import {useRegistry} from './useRegistry.hook'; import {Card} from '../card/Card'; -export function Registry({close, openContact}: {close: () => void; openContact: (params: ContactParams) => void}) { +export function Registry({close, openContact}: {close?: () => void; openContact: (params: ContactParams) => void}) { const {state, actions} = useRegistry(); const theme = useTheme(); diff --git a/app/client/mobile/src/session/Session.tsx b/app/client/mobile/src/session/Session.tsx index e2e9926d..5bc5b296 100644 --- a/app/client/mobile/src/session/Session.tsx +++ b/app/client/mobile/src/session/Session.tsx @@ -197,7 +197,16 @@ function ContentTab({scheme, textCard, contentTab}: {scheme: string, textCard: { ...TransitionPresets.ScaleFromCenterAndroid, }}> {props => ( - props.navigation.goBack()} /> + props.navigation.navigate('details')} close={()=>props.navigation.goBack()} wide={false} /> + )} + + + {props => ( +
props.navigation.goBack()} closeAll={()=>props.navigation.popToTop()} /> )} @@ -258,16 +267,34 @@ function ContactTab({scheme, textContact}: {scheme: string, textContact: (cardId } function DetailsScreen({nav}) { + const [focus, setFocus] = useState(false); + + const closeAll = (props) => { + props.navigation.closeDrawer(); + setFocus(false); + } + + const DetailsComponent = useCallback( + (props) => ( + +
closeAll(props)} + /> + + ), + [nav], + ); + return ( - {({navigation}) => } + {({navigation}) => } ); } @@ -386,7 +413,6 @@ function SettingsScreen({nav}) { } function HomeScreen({nav}) { - const [focus, setFocus] = useState(false); const [textCard, setTextCard] = useState({ cardId: null} as {cardId: null|string}); return ( @@ -396,12 +422,12 @@ function HomeScreen({nav}) { - setFocus(true)} /> + nav.setFocus(true)} /> - {focus && setFocus(false)} />} - {!focus && FOCUS NOT SET} + {nav.focus && nav.setFocus(false)} wide={true} />} + {!nav.focus && FOCUS NOT SET} );