-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathGetRemote.js
62 lines (49 loc) · 1.24 KB
/
GetRemote.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from 'react'
import {
View,
Text,
NativeModules,
Alert
} from 'react-native'
import env from '../../../../config/environment';
import { Container, Header, Title, Content, Button } from 'native-base';
import appStyles from '../../../styles/app';
export class GetConfig extends React.Component {
constructor(props){
super(props);
this.state = {
welcome_message: null
}
}
componentWillMount() {
const {firestack} = this.props;
firestack.remoteConfig.fetchWithExpiration(0)
.then(cfg => console.log(cfg))
.catch(err => config.error(err))
}
getConfig() {
let { firestack } = this.props;
firestack.remoteConfig.config('welcome_message')
.then(value => this.setState({welcome_message: value}))
.catch(error => console.error(error));
}
componentWillUnmount() {
const {firestack} = this.props;
}
render() {
let { welcome_message } = this.state;
return (
<Container>
<Content>
<Button
block
onPress={this.getConfig.bind(this)}>
Get Remote Config - welcome_message
</Button>
<Text>{welcome_message}</Text>
</Content>
</Container>
)
}
}
export default GetConfig