Skip to content

Commit

Permalink
Live Update Deny
Browse files Browse the repository at this point in the history
Added request after denying the conversation to set state on the conversation item
Made wallet string selectable for easier developing
Fixed Android Button styling on home screen
  • Loading branch information
Alex Risch authored and Alex Risch committed Dec 7, 2023
1 parent 5ea4174 commit b6bb12e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NavigationContainer } from '@react-navigation/native'
import React from 'react'
import { Button } from 'react-native'
import { Button, Platform } from 'react-native'
import { QueryClient, QueryClientProvider } from 'react-query'

import ConversationCreateScreen from './src/ConversationCreateScreen'
Expand Down Expand Up @@ -53,7 +53,7 @@ export default function App() {
<Button
onPress={() => navigation.navigate('conversationCreate')}
title="New"
color="#fff"
color={Platform.OS === 'ios' ? '#fff' : 'rgb(49 0 110)'}
/>
),
})}
Expand Down
18 changes: 12 additions & 6 deletions example/src/HomeScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NavigationContext } from '@react-navigation/native'
import moment from 'moment'
import React, { useContext, useState } from 'react'
import React, { useContext, useEffect, useState } from 'react'
import {
Button,
FlatList,
Expand Down Expand Up @@ -46,7 +46,7 @@ export default function HomeScreen() {
}}
>
<Text style={{ fontSize: 14 }}>Connected as</Text>
<Text style={{ fontSize: 14, fontWeight: 'bold' }}>
<Text selectable style={{ fontSize: 14, fontWeight: 'bold' }}>
{client?.address}
</Text>
</View>
Expand All @@ -67,10 +67,16 @@ function ConversationItem({
const lastMessage = messages?.[0]
const [getConsentState, setConsentState] = useState<string | undefined>()

conversation.consentState().then((result) => {
setConsentState(result)
})
const denyContact = () => client?.contacts.deny([conversation.peerAddress])
useEffect(() => {
conversation.consentState().then((result) => {
setConsentState(result)
})
}, [conversation])

const denyContact = () => {
client?.contacts.deny([conversation.peerAddress])
conversation.consentState().then(setConsentState)
}

return (
<Pressable
Expand Down

0 comments on commit b6bb12e

Please sign in to comment.