You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-30Lines changed: 30 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,12 +21,12 @@ Key features include:
21
21
* Practical examples of focus management in complex layouts.
22
22
23
23
24
-
**Note**: While this app contains recommendations, there will always be different approaches on how to build the components or screen or libraries used (FlashList). This guide is a starting point for what needs to be done, but we encourage you to explore and adopt best practices that suit your specific project requirements but always [think in React](https://react.dev/learn/thinking-in-react).
24
+
**Note**: While this app contains recommendations, there will always be different approaches on how to build the components or screen or libraries used (FlashList). This guide is a starting point for what must be done, and you should explore and adopt best practices that suit your specific project requirements but always [think in React](https://react.dev/learn/thinking-in-react).
25
25
26
26
27
27
### Why TV interfaces are different
28
28
29
-
TV applications are navigated primarily with directional controls (up, down, left, right) rather than touch. This fundamentally changes how users interact with your app:
29
+
TV applications are navigated primarily with directional controls (up, down, left, right) rather than touch. This difference fundamentally changes how users interact with your app:
30
30
31
31
* Users can only interact with one element at a time (the focused element).
32
32
* Navigation paths between elements must be clear and predictable.
@@ -73,7 +73,7 @@ You can also use [Vega Studio](https://developer.amazon.com/docs/vega/latest/set
73
73
74
74
1. At the command prompt, navigate to the Vega TV Interfaces Sample App source code directory.
75
75
76
-
2. To install the app dependencies, run the following command.
76
+
2. To install the app dependencies, run the following command. The installation can take several minutes to complete.
77
77
78
78
```
79
79
npm install
@@ -95,21 +95,21 @@ You can also use [Vega Studio](https://developer.amazon.com/docs/vega/latest/set
95
95
96
96
#### Vega Virtual Device
97
97
98
-
1. To start the Vega Virtual Device, at the command prompt, run the following command.
98
+
1. To start the Vega Virtual Device at the command prompt, run the following command.
99
99
100
100
```
101
101
vega virtual-device start
102
102
```
103
103
104
104
2. To install and launch the app on the Vega Virtual Device, run the following command, depending on your device architecture.
RNTL allows us to write tests that closely resemble how users interact with our app. It provides utilities for rendering components, finding elements, and simulating user actions.
167
+
RNTL lets you write tests that closely resemble how users interact with the app. It provides utilities for rendering components, finding elements, and simulating user actions.
168
168
169
169
### Test Commands
170
170
@@ -185,7 +185,7 @@ For more detailed information about our testing setup, best practices, and custo
185
185
Services
186
186
--------
187
187
188
-
The app is structured to delegate specific tasks to encapsulated units of logic known as services. Each service is designed to handle a particular functionality, allowing for clean separation of concerns and ensuring that the logic is reusable and maintainable. This approach allows services to be potentially extracted and used in other applications with ease.
188
+
The app is structured to delegate specific tasks to encapsulated units of logic known as services. Each service is designed to handle a particular functionality, enabling clean separation of concerns and ensuring that the logic is reusable and maintainable. This approach enables services to be potentially extracted and used in other applications with ease.
189
189
190
190
- [**AppConfig Service**](src/services/appConfig/README.md): Manages environment variables defined in the `.env` file, enabling the app to read and apply configuration settings.
191
191
@@ -210,9 +210,9 @@ You can customize the UI by changing the color scheme and font settings.
210
210
211
211
**To customize the color theme**
212
212
213
-
1. Open any color scheme generator for Material Design, for example, https://material-foundation.github.io/material-theme-builder/ and create color scheme that you prefer.
213
+
1. Open any color scheme generator for Material Design, for example, https://material-foundation.github.io/material-theme-builder/ and create a color scheme that you prefer.
214
214
215
-
2. Export created theme as a JSON file.
215
+
2. Export the created theme as a JSON file.
216
216
217
217
3. Go to the **palette.ts** (../../src/theme/palette.ts) file and replace the `lightPalette` and `darkPalette` objects to the generated.
218
218
@@ -245,7 +245,7 @@ You can customize the UI by changing the color scheme and font settings.
245
245
246
246
### Detailed theming information
247
247
248
-
As a part of the Navigation Interface Focus Examples app, the `kepler-ui-components` library is used for the UI layer. All files related to the configuration of the theme should be kept in the **src/theme** directory.
248
+
The Navigation Interface Focus Examples app uses the `kepler-ui-components` library for the UI layer. Keep all files related to theme configuration in the **src/theme** directory.
249
249
250
250
**The src/theme/ directory structure:**
251
251
@@ -264,7 +264,7 @@ src/theme/
264
264
265
265
### Create tokens for components
266
266
267
-
**To modify pre-defined tokens and follow defined palette**
267
+
**To modify predefined tokens and follow a defined palette**
268
268
269
269
1. Create a new file using the following format.
270
270
@@ -331,9 +331,9 @@ New tokens are visible after you reload your app.
331
331
Components
332
332
----------
333
333
334
-
To provide default props and customize components, importing directly from `@amazon-devices/kepler-ui-components` is blocked across the app.
334
+
To provide default props and customize components, the app blocks direct imports from `@amazon-devices/kepler-ui-components`.
335
335
336
-
Every component from UI library should have a created abstraction in the `src/components/core` directory. Please use components from `@AppComponents/core` or create a new one if it doesn't exist.
336
+
Every component from the UI library should have a created abstraction in the `src/components/core` directory. Use components from `@AppComponents/core` or create a new one if it doesn't exist.
337
337
338
338
339
339
```jsx
@@ -355,7 +355,7 @@ import { Button } from '@amazon-devices/kepler-ui-components';
355
355
356
356
#### `useAppTheme`
357
357
358
-
The `useAppTheme` hook is a custom hook built on top of the `useTheme` hook from the `@amazon-devices/kepler-ui-components` package. It provides an easy way to access the the colors of the current theme, and typography from the theme of your application, which conforms to the `AppTheme` type.
358
+
The `useAppTheme` hook is a custom hook built on top of the `useTheme` hook from the `@amazon-devices/kepler-ui-components` package. It provides an easy way to access the colors of the current theme and typography from the theme of your application, which conforms to the `AppTheme` type.
The `useThemedStyles` hook allows you to generate dynamic styles in the component theme. It leverages the `useAppTheme` hook to get the current theme and applies a callback function to generate a `NamedStyles` object.
385
+
The `useThemedStyles` hook lets you generate dynamic styles in the component theme. It leverages the `useAppTheme` hook to get the current theme and applies a callback function to generate a `NamedStyles` object.
***`callback: (theme: AppTheme) => NamedStyles<T>`**: A function that takes the current theme and returns a `NamedStyles` object. This function can be used to generate styles that react to theme changes.
406
+
***`callback: (theme: AppTheme) => NamedStyles<T>`**: A function that takes the current theme and returns a `NamedStyles` object. Use this function to generate styles that react to theme changes.
***`useAppTheme()`**: A custom hook that provides the colors of the current themes and typography.
415
-
***`StyleSheet.NamedStyles`**: A type from React Native's `StyleSheet` API for defining strongly-typed styles.
415
+
***`StyleSheet.NamedStyles`**: A type from React Native's `StyleSheet` API for defining stronglytyped styles.
416
416
417
417
418
418
Set up translations
@@ -422,7 +422,7 @@ This section describes how to adjust existing translations to your needs and inc
422
422
423
423
### Language list
424
424
425
-
All available languages are defined in the **languages.ts** file (../../src/services/i18n/languages.ts).
425
+
The **languages.ts** file (../../src/services/i18n/languages.ts) defines all available languages.
426
426
427
427
```js
428
428
exportconstlanguages= [
@@ -437,7 +437,7 @@ All items must correspond with directories in the **assets/text** directory.
437
437
438
438
### Change existing translations
439
439
440
-
All translations are located in **assets/text** directory using the following structure.
440
+
All translations are located in the **assets/text** directory using the following structure.
441
441
442
442
443
443
```
@@ -467,16 +467,16 @@ To change translations, you must change all needed values in the translation fil
467
467
npm run i18n:sync
468
468
```
469
469
470
-
4. Adjust values of the new keys to a specific language.
470
+
4. Adjust the values of the new keys to a specific language.
471
471
472
472
473
473
### i18n Service details
474
474
475
-
The i18n Service details section provides a React Native context and custom hook for internationalization (i18n) in the Navigation Interface Focus Examples app. This allows for setting and retrieving the current locale and provides a translation function to fetch and format localized messages.
475
+
The i18n Service details section provides a React Native context and custom hook for internationalization (i18n) in the Navigation Interface Focus Examples app. This service enables setting and retrieving the current locale and provides a translation function to fetch and format localized messages.
476
476
477
477
#### Structure
478
478
479
-
Th Navigation Interface Focus Examples app uses the`PUFF-J` files as resources for translation. All files should be created in the **assets/text** directory. New translations should be added in directory with name of language code, for example, **assets/text/es/strings.puff.json**.>
479
+
Th Navigation Interface Focus Examples app uses the`PUFF-J` files as resources for translation. Create all files in the **assets/text** directory. Add new translations in the directory named with the language code, for example, **assets/text/es/strings.puff.json**.
480
480
481
481
```
482
482
assets
@@ -524,29 +524,29 @@ The `useTranslation` hook returns an object containing the following methods:
Fetches the translation for the given `translationId` based on the current locale. This method accepts an optional `params` object that provides dynamic values to inject into the translation string. If the translation can't be found or fails, the `translationId` is returned as a fallback.
527
+
Fetches the translation for the given `translationId` based on the current locale. This method accepts an optional `params` object that provides dynamic values to inject into the translation string. If the translation can't be found or fails, the method returns the `translationId` as a fallback.
528
528
529
529
***`locale`**
530
530
531
-
The current locale, for example, `en-US`. This is the language and region format used to resolve translations.
531
+
The current locale, for example, `en-US`. This value represents the language and region format used to resolve translations.
532
532
533
533
***`setLocale(locale: string)`**
534
534
535
535
A method to change the current locale. When called, it updates the locale across the application.
536
536
537
537
##### `TranslationProvider` component
538
538
539
-
The `TranslationProvider` component is a context provider that wraps your app to supply localization features. It allows for managing the current locale and provides a mechanism to update it across your app.
539
+
The `TranslationProvider` component is a context provider that wraps your app to supply localization features. It manages the current locale and provides a mechanism to update it across your app.
540
540
541
541
#### `TranslationProviderProps`
542
542
543
543
***`children: ReactNode`**
544
544
545
-
The child components that are wrapped by the `TranslationProvider`, and have access to the translation context.
545
+
The child components wrapped by the `TranslationProvider`, which have access to the translation context.
546
546
547
547
***`defaultLocale?: Languages`**
548
548
549
-
(Optional) The default locale to be set when the provider initializes. If not provided, the default locale is set to `'en-US'`.
549
+
(Optional) The default locale to use when the provider initializes. If not provided, the default locale defaults to `'en-US'`.
550
550
551
551
#### Usage
552
552
@@ -563,7 +563,7 @@ const App = () => (
563
563
564
564
#### Syncing translation files
565
565
566
-
To keep all translation files with the same shape, we provide a script to sync the files automatically. After adding default translations (en-US), to generate the same keys for other languages and provide proper values, run the following command.
566
+
To keep all translation files with the same shape, the project provides a script to sync the files automatically. After adding default translations (en-US), to generate the same keys for other languages and provide proper values, run the following command.
0 commit comments