as

Settings
Sign out
Notifications
Alexa
Amazonアプリストア
Ring
AWS
ドキュメント
Support
Contact Us
My Cases
開発
設計と開発
公開
リファレンス
サポート

react-native-screens

react-native-screens

react-native-screensライブラリは、ネイティブのナビゲーションコンテナコンポーネントをReact Nativeに公開します。このライブラリはスタンドアロンライブラリではなく、フル機能のナビゲーションライブラリに依存しています。

インストール

  1. package.jsonファイルに依存関係を追加します。

    クリップボードにコピーしました。

     "dependencies": {
         ...
         "@amazon-devices/react-native-screens": "~2.0.0"
     }
    
  2. npm installコマンドを使用して、npmパッケージを再インストールします。

クリップボードにコピーしました。


import { enableFreeze, enableScreens } from '@amazon-devices/react-native-screens';
import { NavigationContainer } from '@amazon-devices/react-navigation__native';
import { createStackNavigator } from '@amazon-devices/react-navigation__stack';
import * as React from 'react';
import {
  StyleSheet,
  Text,
  TouchableOpacity,
  View
} from 'react-native';

enableScreens();
enableFreeze();

const Stack = createStackNavigator();

//@ts-ignore
const DemoScreen = ({ navigation, route }) => {
  const { id } = route.params;
  return (
    <View>
      <Text>画面{id}</Text>
      {[0,1,2,3].map((buttonId) => (
        <TouchableOpacity onPress={() => navigation.navigate('Screen' + buttonId)}>
          <Text>画面#{buttonId}に移動</Text>
        </TouchableOpacity>
      ))}
      <TouchableOpacity onPress={() => navigation.goBack()}>
        <Text>{"前の画面に戻る"}</Text>
      </TouchableOpacity>
    </View>
  )
}

const screenOptions = { animationEnabled: true }
export const App = () => (
  <NavigationContainer>
    <Stack.Navigator screenOptions={screenOptions} detachInactiveScreens>
      <Stack.Screen key={0} name={"Screen" + 0} component={DemoScreen} initialParams={{ id: 0 }} options={screenOptions} />
      <Stack.Screen key={1} name={"Screen" + 1} component={DemoScreen} initialParams={{ id: 1 }} options={screenOptions} />
      <Stack.Screen key={2} name={"Screen" + 2} component={DemoScreen} initialParams={{ id: 2 }} options={screenOptions} />
      <Stack.Screen key={3} name={"Screen" + 3} component={DemoScreen} initialParams={{ id: 3 }} options={screenOptions} />
    </Stack.Navigator>
  </NavigationContainer>
)

APIリファレンス

コンポーネント

コンポーネント 説明
ScreenContainer 1つ以上のScreenコンポーネントのコンテナです。
Screen ナビゲーション画面に表示するビューのコンテナです。
ScreenStack 1つ以上のScreenコンポーネントを直接の子と見なし、それをプラットフォームネイティブのスタックコンテナにレンダリングします。

Vega向けReact Nativeはreact-native-screens(英語のみ)を使用してネイティブ画面のサポートを追加し、react-native-screens API(英語のみ)と同じAPIをサポートしています。

iOS、Android、およびWindows固有のプロパティはサポートされていません。

既知の問題と制限事項

以下の<Screen>コンポーネントプロパティはサポートされていません(大部分はiOSまたはAndroid固有のプロパティです)。

  • customAnimationOnSwipe
  • fullScreenSwipeEnabled
  • gestureEnabled
  • gestureResponseDistance
  • hideKeyboardOnSwipe
  • homeIndicatorHidden
  • nativeBackButtonDismissalEnabled
  • navigationBarColor
  • navigationBarHidden
  • onHeaderBackButtonClicked
  • onNativeDismissCancelled
  • preventNativeDismiss
  • replaceAnimation
  • screenOrientation
  • sheetAllowedDetents
  • sheetExpandsWhenScrolledToEdge
  • sheetCornerRadius
  • sheetGrabberVisible
  • sheetLargestUndimmedDetent
  • stackAnimation (only fade animation is supported)
  • stackPresentation
  • statusBarAnimation
  • statusBarColor
  • statusBarHidden
  • statusBarStyle
  • statusBarTranslucent
  • swipeDirection
  • transitionDuration

<ScreenStackHeaderConfig>およびその他のヘッダーコンポーネント(<ScreenStackHeaderCenterView>ScreenStackHeaderRightView<ScreenStackHeaderLeftView><ScreenStackHeaderSearchBarView>)はサポートされていません。

react-native-screensを無効にする

ネイティブ画面のサポートを無効にしてプレーンなReact Native Viewを使用するには、エントリファイル(App.js)に以下のコードを追加します。

クリップボードにコピーしました。

import { enableScreens } from '@amazon-devices/react-native-screens';

enableScreens(false);

サポートされているバージョン

パッケージ名 Amazon NPMライブラリのバージョン OSS NPMライブラリのバージョン Vega OSのビルド番号 Vega SDKバージョン リリースノート
@amazon-devices/react-native-screens 2.0.0+3.25.0 3.25.0 OS 1.1 (201010435950) 0.19 システム分散ライブラリとしてリリースされました。初期リリースでは下位互換性のチェックは必要ありません。

その他のライブラリについては、サポート対象のサードパーティのライブラリとサービスを参照してください。


Last updated: 2025年9月30日