react-native-root-tips icon indicating copy to clipboard operation
react-native-root-tips copied to clipboard

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

Open chenyu1990 opened this issue 4 years ago • 1 comments

https://reactnative.dev/blog/2017/02/14/using-native-driver-for-animated#how-do-i-use-this-in-my-app

chenyu1990 avatar May 20 '20 17:05 chenyu1990

This problem occurs when you want to use the version that is installed by default of this library. Inside the code of /node_modules/react-native-root-tips/lib/ToastContainer.js there are 2 functions:

_show _hide

Both require the useNativeDriver option:

Captura de Pantalla 2021-06-26 a la(s) 13 35 55

Lines can be added but every time / node_modules is updated via yarn or npm the changes will disappear.

However, as the library is relatively small and simple, I recommend incorporate it into the main code of your application.

Just copy the /lib, /src folders and index.js file...

Captura de Pantalla 2021-06-27 a la(s) 1 22 46

Paste the files in a folder called /toast (or whatever you like to call) inside your application structure ...

Captura de Pantalla 2021-06-27 a la(s) 1 27 10

And now import Tips from the folder where index.js is hosted (it is not necessary to include index in the path)...

Captura de Pantalla 2021-06-27 a la(s) 1 28 43

Now you can add: useNativeDriver: true useNativeDriver: false useNativeDriver: Platform.OS === 'XXX' ? true : false Depending on what you need.

I only recommend this workaround in simple libraries and for very practical cases like this while the version with corrections is released. To not have volatile code modified in / node_modules.

Note: You can also delete the example.gif file to save space.

Captura de Pantalla 2021-06-27 a la(s) 1 32 29

losthakkun avatar Jun 27 '21 06:06 losthakkun