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

Possible dark video background issue fix #70

Merged
merged 1 commit into from
Apr 17, 2019
Merged
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
Possible dark video background issue fix
  • Loading branch information
lucienbl committed Apr 17, 2019
commit 574268fe66ad05c8e6602f526922a5013388711a
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