Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into style-arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
Morgan Laco committed Oct 4, 2018
2 parents f73c63d + a85251f commit c469790
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 15 deletions.
3 changes: 2 additions & 1 deletion boilerplate/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"mobx-react": "5.1.2",
"mobx-state-tree": "2.0.5",
"ramda": "0.25.0",
"react-native-i18n": "2.0.12",
"react-native-languages": "^3.0.0",
"i18n-js": "^3.0.11",
"react-native-keychain": "3.0.0-rc.3",
"react-native-splash-screen": "3.0.6",
"react-navigation": "2.3.1",
Expand Down
8 changes: 5 additions & 3 deletions boilerplate/src/i18n/i18n.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import I18n from "react-native-i18n"
import RNLanguages from "react-native-languages"
import i18n from "i18n-js"

const en = require("./en")
const ja = require("./ja")

I18n.fallbacks = true
I18n.translations = { en, ja }
i18n.locale = RNLanguages.language
i18n.fallbacks = true
i18n.translations = { en, ja }
6 changes: 3 additions & 3 deletions boilerplate/src/i18n/translate.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import I18n from "react-native-i18n"
import i18n from "i18n-js"

/**
* Translates text.
*
* @param key The i18n key.
*/
export function translate(key: string) {
return key ? I18n.t(key) : null
return key ? i18n.t(key) : null
}

/**
Expand All @@ -16,5 +16,5 @@ export function translate(key: string) {
* @param vars Additional values sure to replace.
*/
export function translateWithVars(key: string, vars: object) {
return key ? I18n.t(key, vars) : null
return key ? i18n.t(key, vars) : null
}
13 changes: 8 additions & 5 deletions boilerplate/src/services/reactotron/reactotron.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,20 @@ if (__DEV__) {
} else {
// attach a mock so if things sneaky by our __DEV__ guards, we won't crash.
console.tron = {
benchmark: noop,
clear: noop,
close: noop,
configure: noop,
connect: noop,
use: noop,
useReactNative: noop,
clear: noop,
log: noop,
logImportant: noop,
display: noop,
error: noop,
image: noop,
log: noop,
logImportant: noop,
reportError: noop,
use: noop,
useReactNative: noop,
warn: noop,
}
}

Expand Down
2 changes: 1 addition & 1 deletion boilerplate/test/mock-i18n.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jest.mock("react-native-i18n", () => {
jest.mock("i18n-js", () => {
return {
t: key => `${key}.test`,
}
Expand Down
4 changes: 2 additions & 2 deletions templates/screen.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { color } from "../../../theme"
<% } -%>
import { NavigationScreenProps } from "react-navigation"

export interface <%= props.pascalName %>ScreenProps extends NavigationScreenProps<{}> {
export interface <%= props.pascalName %>Props extends NavigationScreenProps<{}> {
}

const ROOT: ViewStyle = {
Expand All @@ -25,7 +25,7 @@ const ROOT: ViewStyle = {

// @inject("mobxstuff")
@observer
export class <%= props.pascalName %> extends React.Component<<%= props.pascalName %>ScreenProps, {}> {
export class <%= props.pascalName %> extends React.Component<<%= props.pascalName %>Props, {}> {
render () {
return (
<Screen style={ROOT} preset="fixedCenter">
Expand Down

0 comments on commit c469790

Please sign in to comment.