Skip to content

Commit

Permalink
Remove swiper. First element of single UI stack.
Browse files Browse the repository at this point in the history
  • Loading branch information
nsipplswezey committed Jan 17, 2018
1 parent 8476a49 commit cbff06e
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 30 deletions.
29 changes: 11 additions & 18 deletions nextVoltAGE/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from 'react-native';
import React, { Component } from 'react';
import Camera from 'react-native-camera';
import Swiper from 'react-native-swiper';


import TargetOverlay from './Components/TargetOverlay.js';
Expand Down Expand Up @@ -47,23 +46,18 @@ export default class App extends React.Component {
ref={(cam) => {this.camera = cam;}}
style={styles.preview}
aspect={Camera.constants.Aspect.Fill}
onCNNDetect={(event)=>{
console.log(event.data);
if(event.data > 0.9){this._scrollToIndex(1);}
}}
>
<Swiper
style={styles.wrapper}
showsButtons={true}
showsPagination={false}
loop={false}
autoplayTimeout={0}
ref={(horizontalOne) => {this.horizontalOne = horizontalOne}}
>
{/*
onCNNDetect={(event)=>{
console.log(event.data);
//if(event.data > 0.9){this._scrollToIndex(1);}
}}
*/}
<View style={styles.preview}>
<TargetOverlay />
</View>

{/*
<View style={styles.preview}>
<Image
source={require('./Assets/SunTarget.png')}
Expand Down Expand Up @@ -106,8 +100,7 @@ export default class App extends React.Component {
<Text style={styles.text}>I only breath at night.</Text>
<Text style={styles.text}>Caring for me is as easy as 5,4,3,2,1</Text>
</View>
</Swiper>

*/}
</Camera>
</View>
);
Expand Down Expand Up @@ -144,9 +137,9 @@ export default class App extends React.Component {
//reset view to login if we go background or inactive
if(AppState.currentState === 'background' || AppState.currentState === 'inactive'){
//move the view to login
var login = -this.state.panel;
this.state = {panel: 0};
console.log('reset, scrolled to: ' + login);
// var login = -this.state.panel;
// this.state = {panel: 0};
// console.log('reset, scrolled to: ' + login);
//this.horizontalOne.scrollTo(login);
}
}
Expand Down
34 changes: 24 additions & 10 deletions nextVoltAGE/Components/TargetOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,51 @@ export default class TargetOverlay extends Component{
constructor(props: any){
super(props);
this.state = {
bounceValue: new Animated.Value(0),
wiggleValue: new Animated.Value(0),
bounceValue: new Animated.Value(1.5), //https://stackoverflow.com/questions/47278781/react-native-animation-not-working-properly-on-android
wiggleValue: new Animated.Value(0.01), //https://stackoverflow.com/questions/47278781/react-native-animation-not-working-properly-on-android
bouncing: false,
};
}

render(){
console.log('using native driver')
return(
<Animated.Image
source={require('../Assets/Target.png')}
useNativeDriver= {true}
style={
{flex: 0,
width: 500,
height: 500,
backgroundColor: "transparent", //https://github.com/facebook/react-native/issues/13550
transform: [
{scale: this.state.bounceValue}
{scale: this.state.bounceValue},
{perspective: 1000}, //https://facebook.github.io/react-native/docs/animations.html#bear-in-mind
]}
}
resizeMode={'contain'}/>
)}

componentDidMount() {
this._bounce();
AppState.addEventListener('change',this._handleIOSstateChange.bind(this));
NativeAppEventEmitter.addListener('CameraCNNUpdate', this._handleCNNUpdate.bind(this));
//this._bounce();

Animated.loop(
Animated.spring(
this.state.bounceValue,
{
toValue: 0.8,
friction: 1,
}
)).start();

//AppState.addEventListener('change',this._handleIOSstateChange.bind(this));
//NativeAppEventEmitter.addListener('CameraCNNUpdate', this._handleCNNUpdate.bind(this));
}

componentWillUnmount(){
AppState.removeEventListener('change',()=>{console.log('unmounted: AppState')})
NativeAppEventEmitter.removeListener('CameraCNNUpdate', ()=>{console.log('unmounted:CNN update')})

//AppState.removeEventListener('change',()=>{console.log('unmounted: AppState')})
//NativeAppEventEmitter.removeListener('CameraCNNUpdate', ()=>{console.log('unmounted:CNN update')})
}

_handleIOSstateChange(){
Expand All @@ -75,12 +91,10 @@ export default class TargetOverlay extends Component{
_handleCNNUpdate(data){
console.log('overlay',data.amount);
this.state.wiggleValue.setValue(data.amount);

}

_bounce(){
console.log('wiggle',this.state.wiggleValue);
this.state.bounceValue.setValue(1.5);
Animated.spring(
this.state.bounceValue,
{
Expand Down
2 changes: 2 additions & 0 deletions nextVoltAGE/ios/nextVoltAGE.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = io.github.nsipplswezey.nextVoltAGE;
PRODUCT_NAME = nextVoltAGE;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down Expand Up @@ -1295,6 +1296,7 @@
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = io.github.nsipplswezey.nextVoltAGE;
PRODUCT_NAME = nextVoltAGE;
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -83,6 +84,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
2 changes: 1 addition & 1 deletion nextVoltAGE/ios/nextVoltAGE/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
2 changes: 1 addition & 1 deletion nextVoltAGE/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cbff06e

Please sign in to comment.