Skip to content

Commit

Permalink
fixes for RN 39 bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Milloy committed Dec 23, 2016
1 parent 7a85162 commit 1619d73
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 26 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 1.1.0 (23-12-2016)

Updated to work with react-native ^0.39.2.

### Bug fixes

[fix loadAnimation infinity loop](https://github.com/itsnubix/react-native-video-controls/pull/13)
- added if statement to loadAnimation function to prevent loop

[Crashes with New version of react-native-video](https://github.com/itsnubix/react-native-video-controls/issues/12)
- using latest github version of `react-native-video` to fix multiple issues with RN 39

## 1.0.1 (29-11-2016)

### Features
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# react-native-video-controls
Controls for the React Native `<Video>` component at [react-native-video](https://github.com/react-native-community/react-native-video).
Controls for the React Native `<Video>` component at [react-native-video](https://github.com/react-native-community/react-native-video). 1.1.x works with RN ^0.39.2. For support for lower versions of RN use version 1.0.x.

## Features
This package contains a simple set of GUI controls that work with the [react-native-video](https://github.com/react-native-community/react-native-video) `<Video>` component. This includes a back button, volume bar, fullscreen toggle, play/pause toggle, seekbar, title, error handling and timer toggle that can switch between time remaining and current time when tapped.
Expand All @@ -15,6 +15,8 @@ Run `npm install --save react-native-video-controls`

Then run `react-native link react-native-video`

If you're using RN < 39 run `npm install --save react-native-video-controls@1.0.1`

## Usage
The `<VideoPlayer>` component follows the API of the `<Video>` component at [react-native-video](https://github.com/react-native-community/react-native-video). It also takes a number of additional props which are outlined in the [API](#api) section.

Expand Down
43 changes: 21 additions & 22 deletions VideoPlayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ export default class VideoPlayer extends Component {

state.duration = data.duration;
state.loading = false;

this.setState( state );

if ( state.showControls ) {
Expand Down Expand Up @@ -323,27 +322,29 @@ export default class VideoPlayer extends Component {
}

/**
* Animation to spin loader icon
* Loop animation to spin loader icon. If not loading then stop loop.
*/
loadAnimation() {
Animated.sequence([
Animated.timing(
this.animations.loader.rotate,
{
toValue: this.animations.loader.MAX_VALUE,
duration: 1500,
easing: Easing.linear,
}
),
Animated.timing(
this.animations.loader.rotate,
{
toValue: 0,
duration: 0,
easing: Easing.linear,
}
),
]).start( this.loadAnimation.bind( this ) );
if ( this.state.loading ) {
Animated.sequence([
Animated.timing(
this.animations.loader.rotate,
{
toValue: this.animations.loader.MAX_VALUE,
duration: 1500,
easing: Easing.linear,
}
),
Animated.timing(
this.animations.loader.rotate,
{
toValue: 0,
duration: 0,
easing: Easing.linear,
}
),
]).start( this.loadAnimation.bind( this ) );
}
}

/**
Expand Down Expand Up @@ -1024,8 +1025,6 @@ export default class VideoPlayer extends Component {
muted={ this.state.muted }
rate={ this.state.rate }

playInBackground={ this.opts.playInBackground }
playWhenInactive={ this.opts.playWhenInactive }
repeat={ this.opts.repeat }

onLoadStart={ this.events.onLoadStart }
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-video-controls",
"version": "1.0.1",
"version": "1.1.0",
"description": "A set of GUI controls for the react-native-video component",
"license": "MIT",
"main": "VideoPlayer.js",
Expand All @@ -20,9 +20,9 @@
},
"dependencies": {
"lodash": "^4.16.4",
"react-native-video": "^0.9.0"
"react-native-video": "git+https://github.com/react-native-community/react-native-video.git#master"
},
"peerDependencies": {
"react-native": "*"
"react-native": "^0.39.2"
}
}

0 comments on commit 1619d73

Please sign in to comment.