-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFbtComponent.tsx
57 lines (53 loc) · 1.47 KB
/
FbtComponent.tsx
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
import React from "react";
import { Text, View } from "react-native";
import fbt from "fbt";
import * as Localization from "expo-localization";
console.log({ fbt });
export type FbtComponentProps = {
numOfPeopleWatching: number;
};
export const FbtComponent = ({ numOfPeopleWatching }: FbtComponentProps) => {
const timeOfStart = new Intl.DateTimeFormat(Localization.locale, {
hour: "numeric",
minute: "numeric",
}).format(Date.parse("2022-09-02T16:35:00"));
return (
<View style={style}>
<Text>fbt</Text>
<Text>
<fbt desc="label">Welcome to React Native EU</fbt>
</Text>
<Text>
<fbt desc="plural example">
You have
<fbt:plural
count={numOfPeopleWatching}
name="number of people"
showCount="yes"
many="people"
>
person
</fbt:plural>
watching
</fbt>
</Text>
<Text>
<fbt desc="date interpolation">
What a great conf! This talk starts at
<fbt:param name="startTime">{timeOfStart}</fbt:param>.
</fbt>
</Text>
<Text style={{ fontSize: 20 }}>
<fbt desc="complex sentence">
<Text>META stock</Text>{" "}
<Text style={{ color: "green" }}>went up</Text>{" "}
<Text style={{ fontWeight: "bold" }}> today!</Text>
</fbt>
</Text>
</View>
);
};
const style = {
flex: 1,
justifyContent: "space-around",
} as const;