-
Notifications
You must be signed in to change notification settings - Fork 56
Expand file tree
/
Copy pathConfigExamplePage.tsx
More file actions
43 lines (40 loc) · 1.48 KB
/
Copy pathConfigExamplePage.tsx
File metadata and controls
43 lines (40 loc) · 1.48 KB
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
'use strict';
import {Text} from 'react-native';
import React from 'react';
import {Example} from '../components/Example';
import {Page} from '../components/Page';
import Config from 'react-native-config';
import {useTheme} from '../Navigation';
export const ConfigExamplePage: React.FunctionComponent<{}> = () => {
const {colors} = useTheme();
const example = `<>
<Text>Service URL: {Config.SERVICE_URL}</Text>
<Text>Service port: {Config.SERVICE_PORT}</Text>
<Text>Service API key: {Config.SERVICE_API_KEY}</Text>
</>`;
return (
<Page
title="Config Variables"
description="Shows exposed config variables via the react-native-config module. Keep in mind this module doesn't obfuscate or encrypt secrets for packaging, so do not store sensitive keys in .env."
componentType="Community"
pageCodeUrl="https://github.com/microsoft/react-native-gallery/blob/main/src/examples/ConfigExamplePage.tsx"
documentation={[
{
label: 'Config',
url: 'https://github.com/react-native-config/react-native-config',
},
]}>
<Example title="Config Information" code={example}>
<Text style={{color: colors.text}}>
Service URL: {Config.SERVICE_URL}
</Text>
<Text style={{color: colors.text}}>
Service port: {Config.SERVICE_PORT}
</Text>
<Text style={{color: colors.text}}>
Service API key: {Config.SERVICE_API_KEY}
</Text>
</Example>
</Page>
);
};