diff --git a/boilerplate/.eslintrc.js b/boilerplate/.eslintrc.js index c3c2cb44d..c97fc11bb 100644 --- a/boilerplate/.eslintrc.js +++ b/boilerplate/.eslintrc.js @@ -39,6 +39,16 @@ module.exports = { importNames: ["default"], message: "Import named exports from 'react' instead.", }, + { + name: "react-native", + importNames: ["SafeAreaView"], + message: "Use the SafeAreaView from 'react-native-safe-area-context' instead.", + }, + { + name: "react-native", + importNames: ["Text", "Button", "TextInput"], + message: "Use the custom wrapper component from 'app/src/components'.", + } ], }, ], diff --git a/boilerplate/app/components/Text.tsx b/boilerplate/app/components/Text.tsx index 6349649b6..dd46947c0 100644 --- a/boilerplate/app/components/Text.tsx +++ b/boilerplate/app/components/Text.tsx @@ -1,4 +1,5 @@ import { TOptions } from "i18next" +// eslint-disable-next-line no-restricted-imports import { StyleProp, Text as RNText, TextProps as RNTextProps, TextStyle } from "react-native" import { isRTL, translate, TxKeyPath } from "@/i18n" import type { ThemedStyle, ThemedStyleArray } from "@/theme" diff --git a/boilerplate/app/components/TextField.tsx b/boilerplate/app/components/TextField.tsx index 6e26f69bc..6d49f5262 100644 --- a/boilerplate/app/components/TextField.tsx +++ b/boilerplate/app/components/TextField.tsx @@ -2,6 +2,7 @@ import { ComponentType, forwardRef, Ref, useImperativeHandle, useRef } from "rea import { ImageStyle, StyleProp, + // eslint-disable-next-line no-restricted-imports TextInput, TextInputProps, TextStyle, diff --git a/boilerplate/app/screens/LoginScreen.tsx b/boilerplate/app/screens/LoginScreen.tsx index 33bbe3896..f1817a860 100644 --- a/boilerplate/app/screens/LoginScreen.tsx +++ b/boilerplate/app/screens/LoginScreen.tsx @@ -1,5 +1,6 @@ import { observer } from "mobx-react-lite" import { ComponentType, FC, useEffect, useMemo, useRef, useState } from "react" +// eslint-disable-next-line no-restricted-imports import { TextInput, TextStyle, ViewStyle } from "react-native" import { Button, diff --git a/boilerplate/test/setup.ts b/boilerplate/test/setup.ts index c2f830c3e..cd4f4446f 100644 --- a/boilerplate/test/setup.ts +++ b/boilerplate/test/setup.ts @@ -1,4 +1,5 @@ // we always make sure 'react-native' gets included first +// eslint-disable-next-line no-restricted-imports import * as ReactNative from "react-native" import mockFile from "./mockFile"