Skip to content

Commit

Permalink
fix: Possible dark video background issue fix (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucienbl authored and amaury1093 committed Apr 17, 2019
1 parent 3164403 commit d948b36
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 d948b36

Please sign in to comment.