Kureev / react-native-side-menu

Side menu component for React Native
MIT License
2.21k stars 436 forks source link

Use native driver for the animation #387

Open nes123 opened 4 years ago

nes123 commented 4 years ago

It seems that a simple change will make this library much smoother

animationFunction: (prop, value) => Animated.spring(prop, { toValue: value, friction: 8, }),

goes to:

animationFunction: (prop, value) => Animated.spring(prop, { toValue: value, friction: 8, useNativeDriver: true }),

Captain-ASCII commented 4 years ago

There is also a warning message with React-Native v0.62.2:

Animated: useNativeDriver was not specified. This is a required option and must be explicitly set to true or false

3plusalpha commented 4 years ago

If you see the warning message you can fix yourself like

<SideMenu
      animationFunction={(prop, value) =>
        Animated.spring(prop, {
          toValue: value,
          friction: 8,
          useNativeDriver: true,
        })
      }
/>

This is actually what's defined in the default props here but for some reason the warning still appears.

GleidsonDaniel commented 4 years ago

@3plusalpha worked. Tks

dmantelli commented 4 years ago

@3plusalpha worked !! Thanks you !