Skip to content

Commit

Permalink
chore: remove showSubtitles off implementation from the subtitle styles
Browse files Browse the repository at this point in the history
Removed per feedback from https://github.com/react-native-video/react-native-video/pull/3566/files will create a feature issue to discuss proper implementation.

updated new events.mdx documentation.

removed the note related to showSubtitles use from props.mdx

removed type for showSubtitles

chore: remove showSubtitle type from VideoNativeComponent
  • Loading branch information
coofzilla committed Mar 10, 2024
1 parent b063b19 commit 53be0c4
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ class SubtitleStyle private constructor() {
private set
var paddingBottom = 0
private set
var showSubtitles = true
private set

companion object {
private const val PROP_FONT_SIZE_TRACK = "fontSize"
private const val PROP_PADDING_BOTTOM = "paddingBottom"
private const val PROP_PADDING_TOP = "paddingTop"
private const val PROP_PADDING_LEFT = "paddingLeft"
private const val PROP_PADDING_RIGHT = "paddingRight"
private const val PROP_SHOW_SUBTITLES = "showSubtitles"

@JvmStatic
fun parse(src: ReadableMap?): SubtitleStyle {
Expand All @@ -36,7 +33,6 @@ class SubtitleStyle private constructor() {
subtitleStyle.paddingTop = ReactBridgeUtils.safeGetInt(src, PROP_PADDING_TOP, 0)
subtitleStyle.paddingLeft = ReactBridgeUtils.safeGetInt(src, PROP_PADDING_LEFT, 0)
subtitleStyle.paddingRight = ReactBridgeUtils.safeGetInt(src, PROP_PADDING_RIGHT, 0)
subtitleStyle.showSubtitles = ReactBridgeUtils.safeGetBool(src, PROP_SHOW_SUBTITLES, true)
return subtitleStyle
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ public void setSubtitleStyle(SubtitleStyle style) {
subtitleLayout.setFixedTextSize(TypedValue.COMPLEX_UNIT_SP, style.getFontSize());
}
subtitleLayout.setPadding(style.getPaddingLeft(), style.getPaddingTop(), style.getPaddingRight(), style.getPaddingBottom());
subtitleLayout.setVisibility(style.getShowSubtitles() ? View.VISIBLE : View.GONE);
}

public void setShutterColor(Integer color) {
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/component/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ Example:

### `onTextTrackDataChanged`

<PlatformsList types={['iOS']} />
<PlatformsList types={['Android', 'iOS']} />

Callback function that is called when new subtitle data is available. It provides the actual subtitle content for the current selected text track, if available (mainly WebVTT).

Expand Down
2 changes: 0 additions & 2 deletions docs/pages/component/props.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,6 @@ Example:
subtitleStyle={{ paddingBottom: 50, fontSize: 20 }}
```

>📌 **Note**: The `showSubtitles` property is intended for controlling the display of subtitles. It should be used in conjunction with the `selectedTextTrack` prop to manage subtitle data via `onTextTrackDataChanged` while deciding on their visibility.
### `textTracks`

<PlatformsList types={['Android', 'iOS', 'visionOS']} />
Expand Down
1 change: 0 additions & 1 deletion src/specs/VideoNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ type SubtitleStyle = Readonly<{
paddingBottom?: WithDefault<Float, 0>;
paddingLeft?: WithDefault<Float, 0>;
paddingRight?: WithDefault<Float, 0>;
showSubtitles?: WithDefault<boolean, true>;
}>;

export type OnLoadData = Readonly<{
Expand Down
1 change: 0 additions & 1 deletion src/types/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export type SubtitleStyle = {
paddingBottom?: number;
paddingLeft?: number;
paddingRight?: number;
showSubtitles?: boolean;
};

export enum TextTracksType {
Expand Down

0 comments on commit 53be0c4

Please sign in to comment.