react-native - _reactNative.UIManager.setLayoutAnimationEnabledExperimental 不是函数
问题描述
我正在尝试测试具有此函数调用的 react-native 组件。
UIManager.setLayoutAnimationEnabledExperimental(true);
使用 @testing-library/react-native 渲染此组件时出现此错误。
_reactNative.UIManager.setLayoutAnimationEnabledExperimental is not a function
我尝试使用 jest spyOn 模拟该函数
import { UIManager } from 'react-native';
...
...
beforeEach(() => {
jest
.spyOn(UIManager, 'setLayoutAnimationEnabledExperimental')
.mockImplementation(jest.fn());
})
仍然得到同样的错误,无论如何我可以模拟这个功能?
解决方案
推荐阅读
- phpmyadmin - 在 5.0.2 中更改主题方案?
- excel - 使用excel VBA更新Access表中的记录
- ios - [Swift]我无法从特定 URL 获取任何 JSON 数据
- python - 返回一个数字是否为素数作为 Python 中的布尔值
- javascript - 由于滥用状态,数组未动态更新
- ffmpeg - 从实时 youtube 流中提取帧
- javascript - 为什么此代码在松散相等而不是严格相等时正确运行?
- reactjs - 无法在 HOC 中将钩子用于功能组件
- ios - iOS提交:无效二进制:禁止指令
- google-bigquery - Bigquery中的openstreet地图数据集中缺少美国几何