Android fixes (#515)

* Fix profile screen performance on android and remove dead code

* Correctly handle android hardware back btn

* Fix EditProfile modal for android

* Fix lint
This commit is contained in:
Paul Frazee 2023-04-22 17:14:20 -05:00 committed by GitHub
parent eb6b36be61
commit d35f7c1f1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 273 additions and 594 deletions

View file

@ -18,7 +18,6 @@ import {EmptyState} from '../com/util/EmptyState'
import {Text} from '../com/util/text/Text'
import {FAB} from '../com/util/fab/FAB'
import {s, colors} from 'lib/styles'
import {useOnMainScroll} from 'lib/hooks/useOnMainScroll'
import {useAnalytics} from 'lib/analytics'
import {ComposeIcon2} from 'lib/icons'
@ -32,7 +31,6 @@ export const ProfileScreen = withAuthRequired(
screen('Profile')
}, [screen])
const onMainScroll = useOnMainScroll(store)
const [hasSetup, setHasSetup] = useState<boolean>(false)
const uiState = React.useMemo(
() => new ProfileUiModel(store, {user: route.params.name}),
@ -68,9 +66,12 @@ export const ProfileScreen = withAuthRequired(
track('ProfileScreen:PressCompose')
store.shell.openComposer({})
}, [store, track])
const onSelectView = (index: number) => {
uiState.setSelectedViewIndex(index)
}
const onSelectView = React.useCallback(
(index: number) => {
uiState.setSelectedViewIndex(index)
},
[uiState],
)
const onRefresh = React.useCallback(() => {
uiState
.refresh()
@ -158,7 +159,6 @@ export const ProfileScreen = withAuthRequired(
ListFooterComponent={Footer}
refreshing={uiState.isRefreshing || false}
onSelectView={onSelectView}
onScroll={onMainScroll}
onRefresh={onRefresh}
onEndReached={onEndReached}
/>