fix don't get news list when user don't have project id
This commit is contained in:
parent
0faf2abefd
commit
e26581d425
@ -334,14 +334,9 @@ const MainTitle = connect(state => ({
|
||||
userText = `${name[0]}`;
|
||||
projectName = props.user.project_name
|
||||
}
|
||||
return <View style={{display: 'flex', flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', width: '89%'}}>
|
||||
<View>
|
||||
return <View>
|
||||
<Text style={{ fontSize: 16, color: '#FFFFFF', marginLeft: 10, marginTop: 3, marginBottom: 5 }}>{t('charoensin_asset')} {projectName}</Text>
|
||||
</View>
|
||||
<View>
|
||||
<Text style={{color: 'white'}}>2.0</Text>
|
||||
</View>
|
||||
</View>
|
||||
})
|
||||
|
||||
const MainHeader = ({ navigation }) => {
|
||||
@ -368,7 +363,7 @@ const MainHeader = ({ navigation }) => {
|
||||
}, [])
|
||||
return <View style={[{ flex: 1, alignItems: 'center', flexDirection: 'row', marginTop: 0, paddingLeft: 10, backgroundColor: server_mode === 'develop' ? '#ff0000' : 'transparent' }]}>
|
||||
<TouchableOpacity
|
||||
onPress={openSecretChamber}
|
||||
// onPress={openSecretChamber}
|
||||
activeOpacity={1}>
|
||||
<Image
|
||||
style={{ width: 35, height: 35, }}
|
||||
@ -457,6 +452,7 @@ const AppStack = createStackNavigator({
|
||||
},
|
||||
headerRight: (
|
||||
<View style={{marginRight: 0, justifyContent: 'center', alignItems: 'center', flexDirection: 'row'}}>
|
||||
<Text style={{color: 'white', marginRight: 3}}>2.0</Text>
|
||||
<TouchableOpacity onPress={() => navigation.navigate('LanguageSelect')} style={{marginRight: 8}}>
|
||||
<View style={{width: 30, height: 30, alignItems: 'center', justifyContent: 'center'}}>
|
||||
<Image style={{width: 25, height: 25}} source={langIcon}/></View>
|
||||
@ -467,7 +463,7 @@ const AppStack = createStackNavigator({
|
||||
</View>
|
||||
),
|
||||
headerLeftContainerStyle: {
|
||||
width: '80%',
|
||||
width: '75%',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { createSwitchNavigator, createAppContainer } from 'react-navigation'
|
||||
import { createSwitchNavigator, createAppContainer, SafeAreaView } from 'react-navigation'
|
||||
import AuthStack from './AuthStack'
|
||||
import AppStack from './AppStack'
|
||||
import React from 'react'
|
||||
@ -19,9 +19,9 @@ export class AppNavContainer extends React.Component {
|
||||
}
|
||||
|
||||
render () {
|
||||
return <View style={{ flex: 1 }}>
|
||||
return <SafeAreaView style={{ flex: 1 }}>
|
||||
<MainNav ref={navigatorRef => {NavigationService.setTopLevelNavigator(navigatorRef)}}/>
|
||||
</View>
|
||||
</SafeAreaView>
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,8 +242,24 @@ class NewsScreen extends Component {
|
||||
console.log('project id >>>> ', res.data.project_id)
|
||||
this.checkNotifiedPopup()
|
||||
if(res.data.project_id){
|
||||
this.setState({
|
||||
loadPage: 1,
|
||||
last_page: 1,
|
||||
news_head: [{
|
||||
title: t('loading_news'),
|
||||
content: t('loading_news'),
|
||||
date: t('loading_news'),
|
||||
is_new: false
|
||||
}],
|
||||
new_all: [{
|
||||
title: t('loading_news'),
|
||||
content: t('loading_news'),
|
||||
date: t('loading_news'),
|
||||
is_new: false
|
||||
}],
|
||||
},async () => {
|
||||
await this.getAllNewsByProject(res.data.project_id)
|
||||
|
||||
})
|
||||
}
|
||||
this.setState({
|
||||
noti_count: res.data.count_noti,
|
||||
@ -328,20 +344,6 @@ class NewsScreen extends Component {
|
||||
console.log('initData >>> ')
|
||||
this.setState({
|
||||
isLoading: true,
|
||||
loadPage: 1,
|
||||
last_page: 1,
|
||||
news_head: [{
|
||||
title: t('loading_news'),
|
||||
content: t('loading_news'),
|
||||
date: t('loading_news'),
|
||||
is_new: false
|
||||
}],
|
||||
new_all: [{
|
||||
title: t('loading_news'),
|
||||
content: t('loading_news'),
|
||||
date: t('loading_news'),
|
||||
is_new: false
|
||||
}],
|
||||
}, () => {
|
||||
Promise.all([
|
||||
this.getUser(),
|
||||
@ -594,6 +596,8 @@ class NewsScreen extends Component {
|
||||
}
|
||||
}}
|
||||
>
|
||||
{
|
||||
this.state.user_project_id ?
|
||||
<View style={[styles.row]}>
|
||||
<FlatList
|
||||
data={this.state.news_head}
|
||||
@ -611,7 +615,9 @@ class NewsScreen extends Component {
|
||||
: <View></View>
|
||||
}
|
||||
</View>
|
||||
</View>
|
||||
</View> : <View></View>
|
||||
}
|
||||
|
||||
{
|
||||
this.state.auth !== null &&
|
||||
(
|
||||
@ -817,6 +823,9 @@ class NewsScreen extends Component {
|
||||
))
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
this.state.user_project_id ?
|
||||
<View style={{ padding: 10 }}>
|
||||
<FlatList
|
||||
extraData={this.state}
|
||||
@ -841,7 +850,9 @@ class NewsScreen extends Component {
|
||||
/>)
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
</View> : <View></View>
|
||||
}
|
||||
|
||||
</ScrollView>
|
||||
</BackgroundImage>
|
||||
<IndicatorLoading loadingVisible={this.state.isLoading}/>
|
||||
|
@ -97,7 +97,7 @@ export default class NewsDetailScreen extends Component {
|
||||
source_webview = {
|
||||
baseUrl: '',
|
||||
// uri: `${Config.API_BASE_URL_POWER_CONDO_PROD}/news/${this.state.news_id}/detail`,
|
||||
uri: `${Config.API_BASE_URL_POWER_CONDO_DEV}/news/${this.state.news_id}/detail`
|
||||
uri: `${Config.API_BASE_URL_POWER_CONDO_PROD}/news/${this.state.news_id}/detail`
|
||||
}
|
||||
|
||||
// if(Platform.OS === 'android'){
|
||||
|
Loading…
Reference in New Issue
Block a user