|
|
@@ -19,6 +19,7 @@ export default class Notification extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
+ ready: false,
|
|
|
refreshing: false,
|
|
|
countInfo: {},
|
|
|
pageAdapter: []
|
|
|
@@ -59,21 +60,26 @@ export default class Notification extends Component {
|
|
|
componentDidMount() {
|
|
|
if (app.notifications.showCampaigns && app.notifications.showArticle) {
|
|
|
this.setState({
|
|
|
+ ready: true,
|
|
|
pageAdapter: this.pageAdapterAll
|
|
|
}, () => {
|
|
|
setTimeout(() => {
|
|
|
this.init();
|
|
|
- }, 300);
|
|
|
+ }, 500);
|
|
|
});
|
|
|
} else if (app.notifications.showArticle) {
|
|
|
this.setState({
|
|
|
+ ready: true,
|
|
|
pageAdapter: this.pageAdapter
|
|
|
}, () => {
|
|
|
setTimeout(() => {
|
|
|
this.init();
|
|
|
- }, 300);
|
|
|
+ }, 500);
|
|
|
});
|
|
|
} else {
|
|
|
+ this.setState({
|
|
|
+ ready: true
|
|
|
+ })
|
|
|
this.init();
|
|
|
}
|
|
|
|
|
|
@@ -158,13 +164,18 @@ export default class Notification extends Component {
|
|
|
|
|
|
render() {
|
|
|
const Tab = createMaterialTopTabNavigator();
|
|
|
+ if (!this.state.ready) {
|
|
|
+ return (
|
|
|
+ <View style={styles.container}></View>
|
|
|
+ )
|
|
|
+ }
|
|
|
if (this.state.pageAdapter.length > 0) {
|
|
|
return (
|
|
|
<Tab.Navigator
|
|
|
style={styles.container}
|
|
|
screenOptions={{
|
|
|
- lazy: false,
|
|
|
- lazyPreloadDistance: 1,
|
|
|
+ lazy: isIOS,
|
|
|
+ lazyPreloadDistance: 2,
|
|
|
...this.tabBarStyle
|
|
|
}}
|
|
|
backBehavior={() => this.backPage()}>
|
|
|
@@ -200,12 +211,14 @@ const styles = StyleSheet.create({
|
|
|
backgroundColor: app.isWhitelabel ? colorPrimary : colorLight
|
|
|
},
|
|
|
badgeText: {
|
|
|
- width: 20,
|
|
|
+ minWidth: 20,
|
|
|
height: 20,
|
|
|
color: textLight,
|
|
|
fontSize: 10,
|
|
|
marginTop: 4,
|
|
|
marginRight: 8,
|
|
|
+ paddingLeft: 4,
|
|
|
+ paddingRight: 4,
|
|
|
borderRadius: 30,
|
|
|
fontWeight: 'bold',
|
|
|
alignItems: 'center',
|