Skip to content

Commit

Permalink
fix: some tab issues on android (#5888)
Browse files Browse the repository at this point in the history
  • Loading branch information
hellohublot authored Sep 21, 2024
1 parent 5def256 commit dfc9e5c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const TabComponent = (
tabContentContainerStyle,
style,
onRefresh: onRefreshCallBack,
initialHeaderHeight = 250,
initialHeaderHeight = 220,
}: ITabProps,
// fix missing forwardRef warnings.
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down Expand Up @@ -172,14 +172,22 @@ export const TabComponent = (
);

const onIndexChange = useCallback(() => {}, []);
const onLayout = useCallback(({ nativeEvent }: LayoutChangeEvent) => {
setHeaderHeight(nativeEvent.layout.height);
}, []);
const onLayout = useCallback(
({ nativeEvent }: LayoutChangeEvent) => {
if (nativeEvent.layout.height === headerHeight) {
return;
}
setHeaderHeight(nativeEvent.layout.height);
},
[headerHeight],
);
return (
// @ts-expect-error
<NestedTabView
key={key}
headerHeight={headerHeight}
headerHeight={
platformEnv.isNativeAndroid ? initialHeaderHeight : headerHeight
}
defaultIndex={initialScrollIndex}
style={nestedTabViewStyle}
stickyTabBar
Expand Down
3 changes: 1 addition & 2 deletions packages/kit/src/components/TokenListView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ function TokenListView(props: IProps) {
if (
(isTokenSelector && tokenSelectorSearchTokenState.isSearching) ||
(!isTokenSelector && searchTokenState.isSearching) ||
(!tokenListState.initialized && tokenListState.isRefreshing) ||
(platformEnv.isNativeAndroid && isInRequest)
(!tokenListState.initialized && tokenListState.isRefreshing)
) {
return (
<NestedScrollView style={{ flex: 1 }}>
Expand Down

0 comments on commit dfc9e5c

Please sign in to comment.