簡體   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