Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
preFetch = async () => {
const { params } = this.props.navigation.state
await this.setState({
isLoading: true
})
const targetColor = this.props.screenProps.modeInfo.isNightMode ? '#000' : '#fff'
const result = await Promise.all([
Ionicons.getImageSource('md-arrow-back', 24, targetColor),
Ionicons.getImageSource('md-sync', 24, targetColor),
Ionicons.getImageSource('md-more', 24, targetColor)
])
await this.setState({
leftIcon: result[0],
middleIcon: result[1],
rightIcon: result[2]
})
InteractionManager.runAfterInteractions(() => {
getHomeAPI(params.URL).then(data => {
this.hasGameTable = data.gameTable.length !== 0
// console.log(profileToolbar)
this.setState({
data,
isLoading: false
preFetch = async () => {
const { params } = this.props.navigation.state
await this.setState({
isLoading: true
})
const targetColor = this.props.screenProps.modeInfo.isNightMode ? '#000' : '#fff'
const result = await Promise.all([
Ionicons.getImageSource('md-arrow-back', 24, targetColor),
Ionicons.getImageSource('md-sync', 24, targetColor),
Ionicons.getImageSource('md-more', 24, targetColor)
])
await this.setState({
leftIcon: result[0],
middleIcon: result[1],
rightIcon: result[2]
})
InteractionManager.runAfterInteractions(() => {
getHomeAPI(params.URL).then(data => {
this.hasGameTable = data.gameTable.length !== 0
// console.log(profileToolbar)
this.setState({
data,
preFetch = async () => {
const { params } = this.props.navigation.state
await this.setState({
isLoading: true
})
const targetColor = this.props.screenProps.modeInfo.isNightMode ? '#000' : '#fff'
const result = await Promise.all([
Ionicons.getImageSource('md-arrow-back', 24, targetColor),
Ionicons.getImageSource('md-sync', 24, targetColor),
Ionicons.getImageSource('md-more', 24, targetColor)
])
await this.setState({
leftIcon: result[0],
middleIcon: result[1],
rightIcon: result[2]
})
InteractionManager.runAfterInteractions(() => {
getHomeAPI(params.URL).then(data => {
this.hasGameTable = data.gameTable.length !== 0
// console.log(profileToolbar)
this.setState({
data,
isLoading: false
preFetch = async (forceNew = false) => {
const { params } = this.props.navigation.state
await this.setState({
isLoading: true
})
const targetColor = this.props.screenProps.modeInfo.isNightMode ? '#000' : '#fff'
const result = await Promise.all([
Ionicons.getImageSource('md-arrow-back', 24, targetColor),
Ionicons.getImageSource('md-sync', 24, targetColor),
Ionicons.getImageSource('md-more', 24, targetColor)
])
await this.setState({
leftIcon: result[0],
middleIcon: result[1],
rightIcon: result[2]
})
const data = await getHomeAPI(params.URL)
await this.setState({ data })
console.log(this.props.stats.gameList.length, '====> start dispatch')
if (this.props.stats.isLoading === true) return
const {
gameList,
trophyList,
unearnedTrophyList,
constructor(props) {
super(props);
const menuIcon = Platform.OS === 'ios' ? 'ios-menu' : 'md-menu';
Ionicons.getImageSource(menuIcon, 24, '#FFFFFF').then(icon => {
props.navigator.setButtons({
leftButtons: [
{
icon,
id: 'menu',
},
],
});
});
}
this.isKeyboardShowing = true
this.state.toolbarOpenVal.setValue(0)
})
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {
this.isKeyboardShowing = false
this.shouldShowEmotion === true && Animated.spring(this.state.toolbarOpenVal, {
toValue: 1,
friction: 10
}).start(() => {
this.shouldShowEmotion = false
})
})
this.isToolbarShowing = false
const icon = await Promise.all([
Ionicons.getImageSource('md-arrow-back', 20, '#fff'),
Ionicons.getImageSource('md-happy', 50, '#fff'),
Ionicons.getImageSource('md-photos', 50, '#fff'),
Ionicons.getImageSource('md-send', 50, '#fff'),
Ionicons.getImageSource('md-color-wand', 50, '#fff')
])
this.setState({
icon: {
backIcon: icon[0],
emotionIcon: icon[1],
photoIcon: icon[2],
sendIcon: icon[3],
previewIcon: icon[4]
}
})
}
if(Platform.OS === 'ios') {
Icon.getImageSource('ios-home-outline', 100, theme.tabButton.normalColor).then((source) => this.setState({homeNormal: source}));
Icon.getImageSource('ios-home-outline', 100, tabIconColor).then((source) => this.setState({homeSelected: source}));
Icon.getImageSource('ios-compass-outline', 100, theme.tabButton.normalColor).then((source) => this.setState({compassNormal: source}));
Icon.getImageSource('ios-compass-outline', 100, tabIconColor).then((source) => this.setState({compassSelected: source}));
Icon.getImageSource('ios-list-box-outline', 100, theme.tabButton.normalColor).then((source) => this.setState({moreNormal: source}));
Icon.getImageSource('ios-list-box-outline', 100, tabIconColor).then((source) => this.setState({moreSelected: source}));
Icon.getImageSource('ios-cube-outline', 100, theme.tabButton.normalColor).then((source) => this.setState({collectionNormal: source}));
Icon.getImageSource('ios-cube-outline', 100, tabIconColor).then((source) => this.setState({collectionSelected: source}));
}else if(Platform.OS === 'android'){
Icon.getImageSource('md-home', 100, theme.tabButton.normalColor).then((source) => this.setState({homeNormal: source}));
Icon.getImageSource('md-home', 100, tabIconColor).then((source) => this.setState({homeSelected: source}));
Icon.getImageSource('md-compass', 100, theme.tabButton.normalColor).then((source) => this.setState({compassNormal: source}));
Icon.getImageSource('md-compass', 100, tabIconColor).then((source) => this.setState({compassSelected: source}));
Icon.getImageSource('md-list-box', 100, theme.tabButton.normalColor).then((source) => this.setState({moreNormal: source}));
Icon.getImageSource('md-list-box', 100, tabIconColor).then((source) => this.setState({moreSelected: source}));
Icon.getImageSource('md-cube', 100, theme.tabButton.normalColor).then((source) => this.setState({collectionNormal: source}));
Icon.getImageSource('md-cube', 100, tabIconColor).then((source) => this.setState({collectionSelected: source}));
}
}
this.isKeyboardShowing = false
this.shouldShowEmotion === true && Animated.spring(this.state.toolbarOpenVal, {
toValue: 1,
friction: 10
}).start(() => {
this.shouldShowEmotion = false
})
})
this.isToolbarShowing = false
const icon = await Promise.all([
Ionicons.getImageSource('md-arrow-back', 20, '#fff'),
Ionicons.getImageSource('md-happy', 50, '#fff'),
Ionicons.getImageSource('md-photos', 50, '#fff'),
Ionicons.getImageSource('md-send', 50, '#fff'),
Ionicons.getImageSource('md-color-wand', 50, '#fff')
])
this.setState({
icon: {
backIcon: icon[0],
emotionIcon: icon[1],
photoIcon: icon[2],
sendIcon: icon[3],
previewIcon: icon[4]
}
})
}
componentDidMount() {
Promise.all([
Ionicons.getImageSource('md-arrow-back', 24, '#fff'),
Ionicons.getImageSource('md-more', 24, '#fff')
]).then(result => {
this.setState({
leftIcon: result[0],
rightIcon: result[1]
})
})
}
async componentWillMount() {
this.keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', () => {
Animated.spring(this.state.avoidKeyboardMarginTop, {
toValue: 1,
friction: 10,
useNativeDriver: true
}).start()
})
this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {
Animated.spring(this.state.avoidKeyboardMarginTop, {
toValue: 0,
friction: 10,
useNativeDriver: true
}).start()
})
const source = await Ionicons.getImageSource('ios-add', 24, '#fff')
this.setState({
addIcon: source
})
}