Skip to content

Commit eb0ceac

Browse files
authored
feat: react native docs (#1506)
1 parent 1172b06 commit eb0ceac

26 files changed

Lines changed: 11153 additions & 106 deletions

examples/react-native/.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
node_modules/
2+
.expo/
3+
dist/
4+
npm-debug.*
5+
*.jks
6+
*.p8
7+
*.p12
8+
*.key
9+
*.mobileprovision
10+
*.orig.*
11+
web-build/
12+
13+
# macOS
14+
.DS_Store
15+
16+
# Temporary files created by Metro to check the health of the file watcher
17+
.metro-health-check*
18+
19+
# js translation files should be generated as part of build process
20+
#src/locales/**/*.js
21+
22+
.yarn/*
23+
!.yarn/patches
24+
!.yarn/plugins
25+
!.yarn/releases
26+
!.yarn/sdks
27+
!.yarn/versions

examples/react-native/.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": false,
3+
"trailingComma": "all",
4+
"tabWidth": 2,
5+
"bracketSpacing": true,
6+
"printWidth": 90
7+
}

examples/react-native/.yarnrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

examples/react-native/App.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import "@formatjs/intl-locale/polyfill";
2+
3+
import "@formatjs/intl-pluralrules/polyfill";
4+
import "@formatjs/intl-pluralrules/locale-data/en"; // locale-data for en
5+
import "@formatjs/intl-pluralrules/locale-data/cs"; // locale-data for cs
6+
7+
import React from "react";
8+
import { Text } from "react-native";
9+
import { i18n } from "@lingui/core";
10+
import { I18nProvider, TransRenderProps } from "@lingui/react";
11+
12+
import { messages } from "./src/locales/en/messages.js";
13+
import { Body } from "./src/MainScreen";
14+
15+
i18n.loadAndActivate({ locale: "en", messages });
16+
17+
const DefaultComponent = (props: TransRenderProps) => {
18+
return <Text>{props.children}</Text>;
19+
};
20+
21+
export default function Root() {
22+
return (
23+
<I18nProvider i18n={i18n} defaultComponent={DefaultComponent}>
24+
<Body />
25+
</I18nProvider>
26+
);
27+
}

examples/react-native/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Lingui Demo App
2+
3+
- see https://lingui.dev/tutorials/react-native

examples/react-native/app.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"expo": {
3+
"name": "js-lingui-demo",
4+
"description": "This a simple demo app for lingui.js",
5+
"slug": "js-lingui-demo",
6+
"version": "2.0.1",
7+
"orientation": "portrait",
8+
"icon": "./assets/icon.png",
9+
"userInterfaceStyle": "light",
10+
"splash": {
11+
"image": "./assets/splash.png",
12+
"resizeMode": "contain",
13+
"backgroundColor": "#ffffff"
14+
},
15+
"assetBundlePatterns": [
16+
"**/*"
17+
],
18+
"ios": {
19+
"supportsTablet": true
20+
},
21+
"android": {
22+
"adaptiveIcon": {
23+
"foregroundImage": "./assets/adaptive-icon.png",
24+
"backgroundColor": "#ffffff"
25+
}
26+
},
27+
"web": {
28+
"favicon": "./assets/favicon.png"
29+
}
30+
}
31+
}
17.1 KB
Loading
1.43 KB
Loading
21.9 KB
Loading
46.2 KB
Loading

0 commit comments

Comments
 (0)