setTimeout in React Native

前端 未结 11 2100
没有蜡笔的小新
没有蜡笔的小新 2020-12-14 05:43

I\'m trying to load a splash screen for an iOS app built in React Native. I\'m trying to accomplish this through class states and then a setTimeout function as follows:

11条回答
  •  旧巷少年郎
    2020-12-14 06:04

    Same as above, might help some people.

    setTimeout(() => {
      if (pushToken!=null && deviceId!=null) {
        console.log("pushToken & OS ");
        this.setState({ pushToken: pushToken});
        this.setState({ deviceId: deviceId });
        console.log("pushToken & OS "+pushToken+"\n"+deviceId);
      }
    }, 1000);
    

提交回复
热议问题