Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
selectColor = ({ color = 'default' }) => () => {
const { activeView } = this.state
let newColor = color
if(activeView === VIEWS.COLOR && color === 'default') {
newColor = 'black'
}
if(activeView === VIEWS.FILL && color === 'default') {
newColor = 'transparent'
}
InteractionManager.runAfterInteractions(() => {
this.emit(EVENTS.CHANGE_COLOR_STYLE, { color: newColor, type: activeView })()
})
// this.setDefaultView()
}
PreferencesController.setSelectedAddress(accountsOrdered[newIndex]);
this.props.onAccountChange();
InteractionManager.runAfterInteractions(async () => {
setTimeout(() => {
Engine.refreshTransactionHistory();
}, 1000);
});
} catch (e) {
// Restore to the previous index in case anything goes wrong
this.mounted && this.setState({ selectedAccountIndex: previousIndex });
Logger.error('error while trying change the selected account', e); // eslint-disable-line
}
InteractionManager.runAfterInteractions(() => {
setTimeout(() => {
Analytics.trackEvent(ANALYTICS_EVENT_OPTS.ACCOUNTS_SWITCHED_ACCOUNTS);
}, 1000);
});
const orderedAccounts = this.getAccounts();
this.mounted && this.setState({ orderedAccounts });
});
};
this.setState(state, () => {
InteractionManager.runAfterInteractions(() => {
getTopicCommentAPI(url).then(data => {
let thisList: any[] = []
const thisPage = parseInt(url.match(/\?page=(\d+)/)[1], 10)
let cb = () => { }
if (type === 'down') {
thisList = this.state.list.concat(data.commentList)
this.pageArr.push(thisPage)
} else if (type === 'up') {
thisList = this.state.list.slice()
thisList.unshift(...data.commentList)
this.pageArr.unshift(thisPage)
} else if (type === 'jump') {
// cb = () => this.listView.scrollTo({ y: 0, animated: true });
thisList = data.commentList
this.pageArr = [thisPage]
}
function timerScheduler() {
if (!taskScheduled && nextTask - Date.now() < LONG_TIMER_THRESHOLD) {
taskScheduled = true;
InteractionManager.runAfterInteractions(() => {
try {
const tNext = nextTask - Date.now();
if (tNext < LONG_TIMER_THRESHOLD) {
// reset nextTask
nextTask = Number.MAX_SAFE_INTEGER;
const taskWasRun = longTimers.map(({ runAt, fn, args }) => {
// calculate when this task should be run
const runIn = Math.max(runAt - Date.now(), 1);
if (runIn > LONG_TIMER_THRESHOLD) {
// don't run, and set nextTask run time
nextTask = Math.min(nextTask, runAt);
return false;
}
// schedule task
setTimeout(fn, runIn, ...args);
return true;
_addressCreate(){
let {telephone, fullname, detail, area_id} = this.state;
if (!fullname.length) {
Toast.show('请输入收货人姓名', {position:Toast.positions.CENTER});
return;
}
if (!telephone.length) {
Toast.show('请输入收货人电话', {position:Toast.positions.CENTER});
return;
}
InteractionManager.runAfterInteractions(() => {
const {dispatch, userReducer} = this.props;
let access_token = userReducer.user.access_token;
dispatch(addressCreate(access_token, fullname, telephone, area_id, detail));
});
};
}
this.timer=setTimeout(() => {
InteractionManager.runAfterInteractions(() => {
navigator.resetTo({
component: TabBarView,
name: 'TabBarView'
});
});
}, 2000);
}
componentDidMount(){
if(this.props.currentThread){
this.loadInitialMessages();
InteractionManager.runAfterInteractions(() => {
let thread = this.props.currentThread;
ThreadDao.resetUnreadCount(thread.id);
});
}
}
}, () => {
InteractionManager.runAfterInteractions(() => {
getGameMapperAPI(url).then(data => {
this.setState({
list: data,
isLoadingMore: false,
isRefreshing: false
})
})
})
})
}
handleSeedPhraseState = (seedPhrase = null) =>
InteractionManager.runAfterInteractions(() => this.setState({ seedPhrase }))
componentDidMount(){
super.componentDidMount();
InteractionManager.runAfterInteractions(() => {
this.setState({
didMount: true
});
this.props.actions.getStarState(this.props.rowData);
});
}