Loading...
Loading...
UI recipes for scroll offset (useScrollContentTabBarOffset), view transitions (startViewTransition), horizontal scroll in collapsible tab headers (CollapsibleTabContext), and Android bottom tab touch interception workaround.
npx skill4agent add onekeyhq/app-monorepo 1k-ui-recipes| Recipe | Guide | Key Points |
|---|---|---|
| iOS Tab Bar Scroll Offset | ios-tab-bar-scroll-offset.md | Use |
| Smooth State Transitions | start-view-transition.md | Wrap heavy state updates in |
| Horizontal Scroll in Collapsible Tab Headers | collapsible-tab-horizontal-scroll.md | Bidirectional |
| Android Bottom Tab Touch Interception | android-bottom-tab-touch-intercept.md | Temporary — |
useScrollContentTabBarOffsetpaddingBottomundefinedimport { useScrollContentTabBarOffset } from '@onekeyhq/components';
const tabBarHeight = useScrollContentTabBarOffset();
<ScrollView contentContainerStyle={{ paddingBottom: tabBarHeight }} />startViewTransitionstartViewTransitionsetTimeoutimport { startViewTransition } from '@onekeyhq/components';
startViewTransition(() => {
setIsReady(true);
});renderHeaderGesture.Pan()translateXscrollToCollapsibleTabContextimport { CollapsibleTabContext } from '@onekeyhq/components';Do NOT import directly from. Always use thereact-native-collapsible-tab-view/src/Contextre-export.@onekeyhq/components
Temporary fix — the root cause isintercepting touches even when hidden. This workaround should be removed once the upstream issue is fixed.react-native-bottom-tabs
react-native-bottom-tabsGONE.android.tsxGestureDetectorGesture.Tap()import { Gesture, GestureDetector } from 'react-native-gesture-handler';
import { runOnJS } from 'react-native-reanimated';
const tapGesture = useMemo(
() => Gesture.Tap().onEnd(() => { 'worklet'; runOnJS(onPress)(); }),
[onPress],
);
<GestureDetector gesture={tapGesture}>
<View>
<Button>Label</Button>
</View>
</GestureDetector>Usefile extension so other platforms are unaffected..android.tsx
/1k-cross-platform/1k-performance/1k-coding-patterns