Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

369
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda