Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added controlsStyle props #821

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ For default prop values, please visit [/lib/props.tsx](https://github.com/ihmpav
| **defaultControlsVisible** | `boolean` | Show controls on darker overlay when video starts playing. Default is `false` |
| **timeVisible** | `boolean` | Show current time and final length in the bottom. Default is `true` |
| **textStyle** | `TextStyle` | Object containing `<Text />` styling |
| **controlsStyle** | `FlexStyle` | Basic styling of `Controls` |
| **slider** | `{ visible?: boolean } & SliderProps` | Object containing any of [@react-native-community/slider](https://github.com/callstack/react-native-slider) props. Your styling may break default layout. Also hide slider by providing `visible: false` prop. You are unable to overwrite `ref`, `value`, `onSlidingStart` and `onSlidingComplete` |
| **activityIndicator** | `ActivityIndicatorProps` | Any values from [ActivityIndicator](https://reactnative.dev/docs/activityindicator) |
| **animation** | `{ fadeInDuration?: number, fadeOutDuration?: number }` | Duration of animations in milliseconds |
Expand Down
1 change: 1 addition & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ declare const VideoPlayer: {
defaultControlsVisible: boolean;
timeVisible: boolean;
textStyle: import("react-native").TextStyle;
controlsStyle: import("react-native").FlexStyle;
slider: {
visible?: boolean | undefined;
} & import("@react-native-community/slider").SliderProps;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ const VideoPlayer = (tempProps) => {
</TouchableWithoutFeedback>

<Animated.View pointerEvents={controlsState === ControlStates.Visible ? 'auto' : 'none'} style={[
styles.bottomInfoWrapper,
props.controlsStyle,
{
opacity: controlsOpacity,
},
Expand Down
3 changes: 2 additions & 1 deletion dist/props.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AVPlaybackStatus, Video, VideoProps } from 'expo-av';
import { ActivityIndicatorProps, TextStyle } from 'react-native';
import { ActivityIndicatorProps, TextStyle, FlexStyle } from 'react-native';
import { ColorValue } from 'react-native';
import { ErrorType } from './constants';
import { MutableRefObject, ReactNode } from 'react';
Expand All @@ -17,6 +17,7 @@ declare type DefaultProps = {
defaultControlsVisible: boolean;
timeVisible: boolean;
textStyle: TextStyle;
controlsStyle: FlexStyle;
slider: {
visible?: boolean;
} & SliderProps;
Expand Down
10 changes: 10 additions & 0 deletions dist/props.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ export const defaultProps = {
fontSize: 12,
textAlign: 'center',
},
controlsStyle: {
position: 'absolute',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
flex: 1,
bottom: 0,
left: 0,
right: 0,
},
activityIndicator: {
size: 'large',
color: '#999',
Expand Down
10 changes: 0 additions & 10 deletions dist/utils.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ export declare const styles: {
overflow: "hidden";
padding: number;
};
bottomInfoWrapper: {
position: "absolute";
flexDirection: "row";
alignItems: "center";
justifyContent: "space-between";
flex: number;
bottom: number;
left: number;
right: number;
};
topInfoWrapper: {
position: "absolute";
flexDirection: "row";
Expand Down
10 changes: 0 additions & 10 deletions dist/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ export const styles = StyleSheet.create({
overflow: 'hidden',
padding: 10,
},
bottomInfoWrapper: {
position: 'absolute',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
flex: 1,
bottom: 0,
left: 0,
right: 0,
},
topInfoWrapper: {
position: 'absolute',
flexDirection: 'row',
Expand Down
2 changes: 1 addition & 1 deletion lib/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ const VideoPlayer = (tempProps: Props) => {
<Animated.View
pointerEvents={controlsState === ControlStates.Visible ? 'auto' : 'none'}
style={[
styles.bottomInfoWrapper,
props.controlsStyle,
{
opacity: controlsOpacity,
},
Expand Down
13 changes: 12 additions & 1 deletion lib/props.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AVPlaybackStatus, Video, VideoProps } from 'expo-av'
import { ActivityIndicatorProps, Dimensions, Platform, TextStyle } from 'react-native'
import { ActivityIndicatorProps, Dimensions, Platform, TextStyle, FlexStyle } from 'react-native'
import { ColorValue } from 'react-native'
import { ErrorType } from './constants'
import { MutableRefObject, ReactNode } from 'react'
Expand All @@ -23,6 +23,16 @@ export const defaultProps = {
fontSize: 12,
textAlign: 'center',
},
controlsStyle: {
position: 'absolute',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
flex: 1,
bottom: 0,
left: 0,
right: 0,
},
activityIndicator: {
size: 'large',
color: '#999',
Expand Down Expand Up @@ -80,6 +90,7 @@ type DefaultProps = {
defaultControlsVisible: boolean
timeVisible: boolean
textStyle: TextStyle
controlsStyle: FlexStyle
slider: {
visible?: boolean
} & SliderProps
Expand Down
10 changes: 0 additions & 10 deletions lib/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,6 @@ export const styles = StyleSheet.create({
overflow: 'hidden',
padding: 10,
},
bottomInfoWrapper: {
position: 'absolute',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
flex: 1,
bottom: 0,
left: 0,
right: 0,
},
topInfoWrapper: {
position: 'absolute',
flexDirection: 'row',
Expand Down