Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

370
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda