scanner modal

This commit is contained in:
henrydays 2019-02-07 17:29:45 +00:00
parent ed2c0835cc
commit 00a127f324
6 changed files with 118 additions and 18 deletions

View File

@ -364,12 +364,12 @@ export function checkUser(){
//chamar funçao para renovar
console.log("expirou")
renewToken(a.refreshToken).then(a=>{
renewToken(a.refreshToken).then(b=>{
// a.valid=true;
deleteToken();
saveToken(a);
saveToken(b);
console.log("asdasdasdasd")
dispatch({type: CHECK_USER, token:a, logged:true, onHold:false});
dispatch({type: CHECK_USER, token:b, logged:true, onHold:false});
})

View File

@ -11,6 +11,16 @@ const SecondRoute = () => (
);
const ThirdRoute = () => (
<View style={[styles.scene, { backgroundColor: '#673ab7' }]} />
);
const FourthRoute = () => (
<View style={[styles.scene, { backgroundColor: '#673ab7' }]} />
);
export default class Eventos extends React.Component {
@ -18,10 +28,10 @@ export default class Eventos extends React.Component {
state = {
index: 0,
routes: [
{ key: 'first', title: 'Sex 12' },
{ key: 'second', title: 'Sab 13' },
{ key: 'second', title: 'Dom 14' },
{ key: 'second', title: 'Seg 15' },
{ key: 'first', title: 'Festarola' },
{ key: 'second', title: 'Febrada' },
{ key: 'third', title: 'Rally' },
{ key: 'fourth', title: 'Peddy' },
],
};
@ -33,6 +43,8 @@ render() {
renderScene={SceneMap({
first: FirstRoute,
second: SecondRoute,
third:ThirdRoute,
fourth: FourthRoute
})}
onIndexChange={index => this.setState({ index })}
initialLayout={{ width: Dimensions.get('window').width }}

View File

@ -43,7 +43,6 @@ export default class Login extends Component {
render() {
deviceStorage.isLogged().then(a=>{
console.log(a);

View File

@ -3,6 +3,10 @@ import { View, Image, Vibration, Dimensions,Text ,Button ,TouchableOpacity } fro
import QRCodeScanner from 'react-native-qrcode-scanner';
import {UtilStyles} from '../assets/styles'
import CodeInput from 'react-native-confirmation-code-input';
import Modal from "react-native-modal";
import {RkButton,
RkTheme , RkText} from 'react-native-ui-kitten';
@ -12,19 +16,32 @@ import {RkButton,
export default class Scan extends React.Component {
_toggleModal = () =>
this.setState({ isModalVisible: !this.state.isModalVisible });
_activate=()=>{
this.setState({ isModalVisible: !this.state.isModalVisible ,reactivate:true});
this.scanner.reactivate();
}
onSuccess = (e) => {
// console.log(e.data);
this.setState({reactivate:false})
console.log(e.data);
this.setState({isActive:false});
this._toggleModal();;
console.log(e.data);
};
state = {
isRender: true
isActive:true,
isRender: true,
reactivate:false,
isModalVisible: false
}
componentDidMount() {
this.props.navigation.addListener('willFocus', (route) => {
@ -34,15 +51,69 @@ export default class Scan extends React.Component {
this.setState({ isRender: false })
});
}
render() {
{
return (
<View style={{flex: 1}}>
<Text> Camera Loading....</Text>
{ this.state.isRender &&
<QRCodeScanner />
{ this.state.isRender &&
<QRCodeScanner
showMarker
ref={(node) => { this.scanner = node }}
reactivate={false}
onRead={this.onSuccess.bind(this)}
showMarker={true}
cameraStyle={{ height: SCREEN_HEIGHT }}
fadeIn={true}
customMarker={
<View style={{ flex: 1 }}>
<TouchableOpacity onPress={this._toggleModal}>
<Text>Show Modal</Text>
</TouchableOpacity>
<Modal isVisible={this.state.isModalVisible} style={{backgroundColor:'#E8E8E8', borderRadius:30, height:100}}>
<View style={{ flex: 1 }}>
<Text>Hello!</Text>
<TouchableOpacity onPress={this._toggleModal}>
<Button onPress={this._activate} title="Close" color="#841584" accessibilityLabel="Learn more about this purple button"/>
<Text>Hide me!</Text>
</TouchableOpacity>
</View>
</Modal>
</View>
}
/>
}
</View>
);
)}
return (
<View style={{ flex: 1 }}>
<TouchableOpacity onPress={this._toggleModal}>
<Text>Show Modal</Text>
</TouchableOpacity>
<Modal isVisible={this.state.isModalVisible}>
<View style={{ flex: 1 }}>
<Text>Hello!</Text>
<TouchableOpacity onPress={this._toggleModal}>
<Text>Hide me!</Text>
</TouchableOpacity>
</View>
</Modal>
</View>
);
}
}

17
App/package-lock.json generated
View File

@ -6860,6 +6860,14 @@
"yargs": "^9.0.0"
}
},
"react-native-animatable": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/react-native-animatable/-/react-native-animatable-1.3.1.tgz",
"integrity": "sha512-NoE6OAgCrhggWBRV6rBJup5vLAGoTjx168Tku1RZmjUGIdYRAyGesP/MoqvxiNJjhTAgwYx2LT63VTT1xO8g4Q==",
"requires": {
"prop-types": "^15.5.10"
}
},
"react-native-app-intro-slider": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/react-native-app-intro-slider/-/react-native-app-intro-slider-1.0.1.tgz",
@ -6909,6 +6917,15 @@
"resolved": "https://registry.npmjs.org/react-native-loader/-/react-native-loader-1.2.1.tgz",
"integrity": "sha1-4IWJqJz80HZZW5MBwdYY9U2nMyk="
},
"react-native-modal": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/react-native-modal/-/react-native-modal-7.0.2.tgz",
"integrity": "sha512-IRTDeErr4asDdPs4DGbaKvz3fgr56tcVA7nAdCLu4IkjNw7DaIlAbQelg0Sdirb+8+RbIDPyrrnuEH84Fnj4ZA==",
"requires": {
"prop-types": "^15.6.1",
"react-native-animatable": "^1.2.4"
}
},
"react-native-permissions": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/react-native-permissions/-/react-native-permissions-1.1.1.tgz",

View File

@ -17,6 +17,7 @@
"react-native-gesture-handler": "^1.0.15",
"react-native-ionicons": "^4.5.5",
"react-native-loader": "^1.2.1",
"react-native-modal": "^7.0.2",
"react-native-progress": "^3.5.0",
"react-native-qrcode-scanner": "^1.1.2",
"react-native-timeline-feed": "^1.0.1",