as

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

KeplerCaptionsView

KeplerCaptionsView

概要

クローズドキャプションや字幕を画面上にレンダリングするReact Nativeコンポーネントです。このコンポーネントは、VideoPlayerコンポーネントやAudioPlayerコンポーネントを使用してプレバッファリングモードで動作している場合にのみ使用してください。

アプリでは、onCaptionViewCreatedイベントコールバックで渡されたキャプションハンドルを、setCaptionViewHandle関数を通じてVideoPlayerAudioPlayerに関連付けて、プレーヤーがキャプションや字幕を画面上にレンダリングできるようにします。

拡張

コンストラクタ

new KeplerCaptionsView()

new KeplerCaptionsView(props): KeplerCaptionsView

パラメーター

props

CaptionViewProps

戻り値

KeplerCaptionsView

オーバーライド

React.Component<CaptionViewProps>.constructor

プロパティ

context

context: unknown

新しいスタイルコンテキストを使用する場合は、これをクラス内で再宣言して、静的なcontextTypeReact.ContextTypeを指すようにします。型注釈またはstatic contextTypeと一緒に使用する必要があります。

static contextType = MyContext
// TS 3.7より前の場合:
context!: React.ContextType<typeof MyContext>
// TS 3.7以降の場合:
declare context: React.ContextType<typeof MyContext>

参照

Reactドキュメント(英語のみ)

継承元

React.Component.context


props

readonly props: Readonly<CaptionViewProps>

継承元

React.Component.props


refs

refs: object

インデックスシグネチャ

[key: string]: ReactInstance

廃止

参照

レガシーReactドキュメント(英語のみ)

継承元

React.Component.refs


state

state: Readonly<{}>

継承元

React.Component.state


contextType?

static optional contextType: Context<any>

設定されている場合、this.contextは実行時に指定コンテキストの現在の値に設定されます。

type MyContext = number
const Ctx = React.createContext<MyContext>(0)

class Foo extends React.Component {
  static contextType = Ctx
  context!: React.ContextType<typeof Ctx>
  render () {
    return <>マイコンテキスト値:{this.context}</>;
  }
}

参照

https://react.dev/reference/react/Component#static-contexttype

継承元

React.Component.contextType

メソッド

componentDidCatch()?

optional componentDidCatch(error, errorInfo): void

子孫コンポーネントで生成された例外をキャッチします。未処理の例外が発生すると、コンポーネントツリー全体がマウント解除されます。

パラメーター

error

Error

errorInfo

ErrorInfo

戻り値

void

継承元

React.Component.componentDidCatch


componentDidMount()?

optional componentDidMount(): void

コンポーネントがマウントされた直後に呼び出されます。ここで状態を設定すると、再レンダリングがトリガーされます。

戻り値

void

継承元

React.Component.componentDidMount


componentDidUpdate()?

optional componentDidUpdate(prevProps, prevState, snapshot?): void

更新が行われた直後に呼び出されます。初回のレンダリングでは呼び出されません。

snapshotは、getSnapshotBeforeUpdateが存在してnull以外を返す場合にのみ渡されます。

パラメーター

prevProps

Readonly<CaptionViewProps>

prevState

Readonly<{}>

snapshot?

any

戻り値

void

継承元

React.Component.componentDidUpdate


componentWillMount()?

optional componentWillMount(): void

マウントが発生する直前およびComponent.renderの前に呼び出されます。このメソッド内で副作用やサブスクリプションを導入することは避けてください。

注:NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate、またはStaticLifecycle.getDerivedStateFromProps getDerivedStateFromPropsが存在すると、これが呼び出されません。

戻り値

void

廃止

16.3では、代わりにComponentLifecycle.componentDidMount componentDidMount、またはコンストラクタを使用してください。React 17では動作しなくなります

参照

継承元

React.Component.componentWillMount


componentWillReceiveProps()?

optional componentWillReceiveProps(nextProps, nextContext): void

コンポーネントが新しいプロパティを受け取る可能性があるときに呼び出されます。プロパティが変更されていなくてもReactから呼び出されることがあるため、変更のみを処理する場合は、必ず新しいプロパティと既存のプロパティを比較してください。

通常、Component.setStateを呼び出しても、このメソッドはトリガーされません。

注:NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate、またはStaticLifecycle.getDerivedStateFromProps getDerivedStateFromPropsが存在すると、これが呼び出されません。

パラメーター

nextProps

Readonly<CaptionViewProps>

nextContext

any

戻り値

void

廃止

16.3では、代わりにStaticLifecycle.getDerivedStateFromProps getDerivedStateFromPropsを使用してください。React 17では動作しなくなります

参照

継承元

React.Component.componentWillReceiveProps


componentWillUnmount()?

optional componentWillUnmount(): void

コンポーネントが破棄される直前に呼び出されます。Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any DOM elements created in componentDidMount.

戻り値

void

継承元

React.Component.componentWillUnmount


componentWillUpdate()?

optional componentWillUpdate(nextProps, nextState, nextContext): void

新しいプロパティまたは状態を受け取ったときに、レンダリングの直前に呼び出されます。初回のレンダリングでは呼び出されません。

注: ここでComponent.setStateを呼び出すことはできません。

注:NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate、またはStaticLifecycle.getDerivedStateFromProps getDerivedStateFromPropsが存在すると、これが呼び出されません。

パラメーター

nextProps

Readonly<CaptionViewProps>

nextState

Readonly<{}>

nextContext

any

戻り値

void

廃止

16.3、代わりにgetSnapshotBeforeUpdateを使用してください。React 17では動作しなくなります。

参照

継承元

React.Component.componentWillUpdate


forceUpdate()

forceUpdate(callback?): void

パラメーター

callback?

() => void

戻り値

void

継承元

React.Component.forceUpdate


getSnapshotBeforeUpdate()?

optional getSnapshotBeforeUpdate(prevProps, prevState): any

ReactがComponent.renderのレンダリングの結果をドキュメントに適用する前に実行され、componentDidUpdateに渡されるオブジェクトを返します。Component.renderレンダリングによって変更が加えられる前に、スクロール位置などの情報を保存するために役立ちます。

注:このメソッドが存在すると、非推奨のライフサイクルイベントは実行されません。

パラメーター

prevProps

Readonly<CaptionViewProps>

prevState

Readonly<{}>

戻り値

any

継承元

React.Component.getSnapshotBeforeUpdate


setState()

setState<K>(state, callback?): void

型パラメーター

K extends never

パラメーター

state
{} (prevState, props) => {} | Pick<{}, K> Pick<{}, K>
callback?

() => void

戻り値

void

継承元

React.Component.setState


shouldComponentUpdate()?

optional shouldComponentUpdate(nextProps, nextState, nextContext): boolean

プロパティと状態の変更の結果、再レンダリングをトリガーする必要があるかどうかを決定するために呼び出されます。

Component always returns true.PureComponentはプロパティと状態の浅い比較を実装し、いずれかのプロパティまたは状態が変更されている場合にtrueを返します。

falseが返された場合、Component.render、componentWillUpdatecomponentDidUpdateは呼び出されません。

パラメーター

nextProps

Readonly<CaptionViewProps>

nextState

Readonly<{}>

nextContext

any

戻り値

boolean

継承元

React.Component.shouldComponentUpdate


UNSAFE_componentWillMount()?

optional UNSAFE_componentWillMount(): void

マウントが発生する直前およびComponent.renderの前に呼び出されます。このメソッド内で副作用やサブスクリプションを導入することは避けてください。

このメソッドはReact 17でも動作します。

注:NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate、またはStaticLifecycle.getDerivedStateFromProps getDerivedStateFromPropsが存在すると、これが呼び出されません。

戻り値

void

廃止

16.3では、代わりにComponentLifecycle.componentDidMount componentDidMount、またはコンストラクタを使用してください。

参照

継承元

React.Component.UNSAFE_componentWillMount


UNSAFE_componentWillReceiveProps()?

optional UNSAFE_componentWillReceiveProps(nextProps, nextContext): void

コンポーネントが新しいプロパティを受け取る可能性があるときに呼び出されます。プロパティが変更されていなくてもReactから呼び出されることがあるため、変更のみを処理する場合は、必ず新しいプロパティと既存のプロパティを比較してください。

通常、Component.setStateを呼び出しても、このメソッドはトリガーされません。

このメソッドはReact 17でも動作します。

注:NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate、またはStaticLifecycle.getDerivedStateFromProps getDerivedStateFromPropsが存在すると、これが呼び出されません。

パラメーター

nextProps

Readonly<CaptionViewProps>

nextContext

any

戻り値

void

廃止

16.3では、代わりにStaticLifecycle.getDerivedStateFromProps getDerivedStateFromPropsを使用してください。

参照

継承元

React.Component.UNSAFE_componentWillReceiveProps


UNSAFE_componentWillUpdate()?

optional UNSAFE_componentWillUpdate(nextProps, nextState, nextContext): void

新しいプロパティまたは状態を受け取ったときに、レンダリングの直前に呼び出されます。初回のレンダリングでは呼び出されません。

注: ここでComponent.setStateを呼び出すことはできません。

このメソッドはReact 17でも動作します。

注:NewLifecycle.getSnapshotBeforeUpdate getSnapshotBeforeUpdate、またはStaticLifecycle.getDerivedStateFromProps getDerivedStateFromPropsが存在すると、これが呼び出されません。

パラメーター

nextProps

Readonly<CaptionViewProps>

nextState

Readonly<{}>

nextContext

any

戻り値

void

廃止

16.3、代わりにgetSnapshotBeforeUpdateを使用してください。

参照

継承元

React.Component.UNSAFE_componentWillUpdate


Last updated: 2025年10月2日