I have the error undefined is not an object (evaluating 'animation.scale') in my _Expo React Native_ application, which seems to come from the Menu component.
Here is an extract from the stacktrace
TypeError: TypeError: undefined is not an object (evaluating 'animation.scale')
- node_modules/react-native-paper/lib/module/components/Menu/Menu.js:1:4776 in <unknown>
- node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-dev.js:13857:16 in callCallback
- ... 33 more stack frames from framework internals
It seems to come from 3.x bump we've made some time ago
Here is how we call our <Menu />
<Menu
visible={visible}
onDismiss={toggleMenu}
anchor={<SomeCustomTouchableOpacityComponent />}
>
{[0, 1, 2, 3].map(item => (
<Menu.Item
key={item}
onPress={() => {
// do something
}}
title={`Item ${item}`}
/>
))}
</Menu>;
Expo CLI 3.9.1 environment info:
System:
OS: macOS 10.15.1
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.19.1 - /usr/local/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.3 AI-182.5107.16.33.5314842
Xcode: 11.2.1/11B500 - /usr/bin/xcodebuild
npmPackages:
expo: ^35.0.1 => 35.0.1
react: 16.8.3 => 16.8.3
react-native: https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz => 0.59.8
[email protected]
@nicolasrouanne Since v3.0 you need to pass additional properties to the theme. The object you pass has to look like this:
const theme = {
// old properties,
animation: {
scale: 1.0,
},
}
You can control animations speed with this new property. Currently only few components support this, but we aim to update all component in v4.
Indeed, adding this animation key to the theme fixes my crash 馃憤
Was that something I missed in the documentation or 3.0 breaking changes? 馃槩
Most helpful comment
@nicolasrouanne Since v3.0 you need to pass additional properties to the theme. The object you pass has to look like this:
You can control animations speed with this new property. Currently only few components support this, but we aim to update all component in v4.