ggunti / react-native-amazing-cropper

Image cropper for react native using Animated API
MIT License
145 stars 83 forks source link

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

Closed kevgrig closed 3 years ago

kevgrig commented 4 years ago

This is a new warning in React 0.62.0:

Make setting useNativeDriver required. Add runtime warning if not specified (5876052615 by @TheSavior)

The background is here: https://reactnative.dev/blog/2017/02/14/using-native-driver-for-animated/

However, that notes:

Not everything you can do with Animated is currently supported in Native Animated. The main limitation is that you can only animate non-layout properties, things like transform and opacity will work but Flexbox and position properties won't.

Here is an example stack of the react-native-amazing-cropper warning:

Animated: `useNativeDriver` was not specified. This is a required option and must be explicitly set to `true` or `false`
- node_modules/react-native/Libraries/LogBox/LogBox.js:117:10 in registerWarning
- node_modules/react-native/Libraries/LogBox/LogBox.js:63:8 in warnImpl
- node_modules/react-native/Libraries/LogBox/LogBox.js:36:4 in console.warn
- node_modules/expo/build/environment/react-native-logs.fx.js:18:4 in warn
- node_modules/react-native/Libraries/Animated/src/NativeAnimatedHelper.js:284:4 in shouldUseNativeDriver
- node_modules/react-native/Libraries/Animated/src/animations/SpringAnimation.js:106:49 in constructor
- node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:154:26 in start
- node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:160:13 in start
- node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:374:10 in animations.forEach$argument_0
* [native code]:null in forEach
- node_modules/react-native/Libraries/Animated/src/AnimatedImplementation.js:356:6 in result.start
- node_modules/react-native-amazing-cropper/dist/src/pages/Cropper.page.js:273:82 in PanResponder.create$argument_0.onPanResponderRelease
- node_modules/react-native/Libraries/Interaction/PanResponder.js:572:12 in clearInteractionHandle
[...]

Since Cropper is using Animated on a position property, I think useNativeDriver should be set to false.

kevgrig commented 4 years ago

@3GOMESz I don't think that's fair. He recently implemented something for me and is relatively responsive for a free project. I do hope to find time to prototype the changes for the issue but it's not as easy as just a PR: it requires testing, etc.

gomes042 commented 4 years ago

What do you mean "fair"? I just want to say that this kind of problem is solved with literally one line of code and the last update on the project was 5 months ago.

@3GOMESz I don't think that's fair. He recently implemented something for me and is relatively responsive for a free project. I do hope to find time to prototype the changes for the issue but it's not as easy as just a PR: it requires testing, etc.

ggunti commented 3 years ago

Fixed in version 0.1.5