TypeError:无法读取未定义的属性“ LENGTH_LONG”

时间:2018-07-04 11:15:23

标签: react-native

 FAIL  __tests__\jest\LoginScreen.test.js
  ● Test suite failed to run

    TypeError: Cannot read property 'LENGTH_LONG' of undefined

      10 |     ScrollView
      11 | } from "react-native";
    > 12 | import Snackbar from 'react-native-snackbar';
      13 |
      14 | import { connect } from "react-redux";
      15 | import { Button, Text, Divider } from "react-native-elements";

      at Object.<anonymous> (node_modules/react-native-snackbar/lib/index.js:1:252)
      at Object.<anonymous> (src/screens/login/loginScreen.js:12:26)
      at Object.<anonymous> (__tests__/jest/LoginScreen.test.js:3:18)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        2.689s, estimated 4s
Ran all test suites matching /login/i.

我正在用react native做开玩笑的测试,并且我在项目中使用了Snackbar。在执行笑话时,我收到此错误。“ LENGTH_LONG”是小吃店中的内置变量。我正在发布使用“ LENGTH_LONG”变量和错误的位置。有人请帮帮我

render() {
        return (
            <View style={styles.mainContainer}>
                {this.renderTopLogoContainer()}
                {this.renderBottomContainer()}

                {this.props.hasError ? Snackbar.show({
                    title: this.props.error.display_message,
                    duration: Snackbar.LENGTH_LONG
                }) : null}
            </View>
        );
    }

Error

0 个答案:

没有答案