Skip to content

Commit

Permalink
Merge pull request #1 from lucienbl/video-patch
Browse files Browse the repository at this point in the history
Possible dark video background issue fix
  • Loading branch information
lucienbl committed Apr 17, 2019
2 parents cacc81f + 574268f commit c538eba
Showing 1 changed file with 25 additions and 12 deletions.
37 changes: 25 additions & 12 deletions App/Screens/Home/SmokeVideo/SmokeVideo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: GPL-3.0

import React, { Component } from 'react';
import { Dimensions, StyleSheet } from 'react-native';
import { Dimensions, StyleSheet, View } from 'react-native';
import { inject, observer } from 'mobx-react';
import { Video } from 'expo';

Expand All @@ -16,26 +16,39 @@ export class SmokeVideo extends Component {
stores: { cigarettes }
} = this.props;

if (cigarettes <= 1) return { opacity: 0.2 };
if (cigarettes < 5) return { opacity: 0.5 };
if (cigarettes < 15) return { opacity: 0.7 };
return { opacity: 1 };
if (cigarettes <= 1) return { backgroundColor: '#FFFFFFCC' };
if (cigarettes < 5) return { backgroundColor: '#FFFFFFAA' };
if (cigarettes < 15) return { backgroundColor: '#FFFFFF22' };
return { backgroundColor: '#FFFFFF00' };
};

render () {
return (
<Video
isLooping
resizeMode='cover'
shouldPlay
source={smokeVideo}
style={[styles.video, this.getVideoStyle()]}
/>
<View style={styles.container}>
<View style={[styles.overlay, this.getVideoStyle()]} />
<Video
isLooping
resizeMode='cover'
shouldPlay
source={smokeVideo}
style={styles.video}
/>
</View>
);
}
}

const styles = StyleSheet.create({
container: {
bottom: 0,
height: Dimensions.get('screen').height,
position: 'absolute',
right: 0,
width: Dimensions.get('screen').width
},
overlay: {
flex: 1
},
video: {
bottom: 0,
height: Dimensions.get('screen').height,
Expand Down

0 comments on commit c538eba

Please sign in to comment.