1

I've search all similar issues on Stackoverflow something like this, but I have a different problem since that question is asking to call parent function from child component

Here's the code I've tried:

export default ()=>{
  const Drawer = createDrawerNavigator();
  const [progress, setProgress] = React.useState(new Reanimated.Value(0));
  const scale = Reanimated.interpolate(progress, {
    inputRange: [0, 1],
    outputRange: [1, 0.8],
  });
  const animatedStyle = { borderRadius, transform: [{ scale }] };
  return(
    <NavigationContainer>
      <View style={{flex:1, backgroundColor:'black'}}>
        <Drawer.Navigator
          {...anotherProps}
          drawerContent={props=>{
            setProgress(props.progress); //Here the Warning appears
            return <CustomDrawer {...props}/>
          }}
        >
          <Drawer.Screen name="Drawer">
            {StackNavigatorScreen}
          </Drawer.Screen>
        </Drawer.Navigator>
      </View>
    </NavigationContainer>
  )
}

Anyone can help what should I do with my current code to make this warning disappear?

Cannot update a component from inside the function body of a different component

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
flix
  • 1,688
  • 3
  • 34
  • 64

0 Answers0