Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

367
Views
custom drawer animation with react navigation using useDrawerProgress()

I'm trying to achieve this animation with react navigation v6 where the Screen scales down when the drawer is opened.

Here's my code so far:

App.js

<Drawer.Navigator
      drawerContent={(props) => <CustomDrawer {...props} />}
      initialRouteName="Home"
    >
      <Drawer.Screen name="Home" component={Home} />
      <Drawer.Screen name="About" component={About} />
</Drawer.Navigator>

Home.js

const Home = ({ navigation, setProgress }) => {

  const progress = useDrawerProgress();

  const scale = Animated.interpolateNode(progress.value, {
    inputRange: [0, 1],
    outputRange: [1, 0.7],
  });

...

return (
    <Animated.View style={{ flex: 1, transform: [{ scale }] }}>

     ...

    </Animated.View>

However this doesn't work as expected, transform: scale doesn't change in the ui. If I make some dummy changes to Home.js while the drawer in open the Home screen suddenly scales down.

I think the const progress = useDrawerProgress() doesn't updates the progress

Edit: Very similar to this question here

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

useDrawerProgress update progress of opening drawer, but we need small rewrite logic of animation try this:

import { interpolate, Extrapolate, useAnimatedStyles } from react-native-reanimated;

.
.
.

const drawerProgress = useDrawerProgress();
const animatedStyle = useAnimatedStyle(() => {
  const scale = interpolate(drawerProgress.value, [0, 1], [1, 0.8], {
    extrapolateRight: Extrapolate.CLAMP,
  });
  const borderRadius = interpolate(drawerProgress.value, [0, 1], [0, 10], {
    extrapolateRight: Extrapolate.CLAMP,
  });
  return {
    transform: [{ scale }],
    borderRadius,
  };
});
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!