繁体   English   中英

React Native - 未找到 SetTimeout 变量

[英]React Native - SetTimeout variable not found

尝试在设定的时间内加载启动画面,但错误读取 ReferenceError:找不到变量:SetTimeout。

import React, { Component } from 'react';
import { Image, View } from 'react-native';
import { inject } from 'mobx-react';

@inject("stores")
export default class SplashScreen extends Component {
    constructor(props) {
        super(props)
    }
    componentDidMount() {
        const { stores, navigation } = this.props;
        SetTimeout (() => {
            navigation.navigate("Login")
        }, stores.config.SplashTime)
    }
    render() {
        const { stores } = this.props
        return ( 
            <View style={{flex: 1}}>
            <Image style={{flex: 1, width: null, height: null}} source={stores.config.SplashIMG}/>
            </View>
        )
    }
}

正如 SakoBu 指出的那样,setTimeout 的拼写不正确! 方法名称区分大小写。 如果不能解决问题,也可以尝试 window.setTimeout。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM