简体   繁体   中英

React Native - SetTimeout variable not found

Trying to load a splash screen for a set amount of time but error reads ReferenceError: Can't find variable: 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>
        )
    }
}

The spelling for setTimeout is incorrect as SakoBu pointed out! Method names are case sensitive. Also try window.setTimeout if that does not fix the problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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