import React, {Component} from 'react'; import {ScrollView, Text, StyleSheet, View, Modal, TouchableHighlight, AsyncStorage} from 'react-native'; import DeviceInfo from 'react-native-device-info' import Accordion from 'react-native-collapsible/Accordion'; import * as Animatable from 'react-native-animatable'; import FitImage from 'react-native-fit-image'; import {Header, Icon} from 'react-native-elements' var services = require('../assets/service.json'); // // var SECTIONS = [ // { // title: 'Netflix', // nom: 'DELIGNIERES', // prenom: 'Matthieu', // sexe: 'Homme', // ville: 'Anzin', // isAbo: 'true', // durationAbo: '6 mois', // hasNews: 'false', // image: 'https://img3.telestar.fr/var/telestar/storage/images/3/0/5/6/3056045/netflix-annonce-des-projets-france_width1024.png' // }, // { // title: 'Allocine', // nom: 'HUBLARD', // prenom: 'Grobin', // sexe: 'Male', // ville: 'Campagne', // isAbo: 'true', // durationAbo: '3 mois', // hasNews: 'true', // image: 'http://www.business-actor.com/wp-content/uploads/2013/07/logo-allocine.png' // }, // { // title: 'Brazzer', // nom: 'Sabadini', // prenom: 'Jerome', // sexe: 'Homme', // ville: 'Valenciennes', // isAbo: 'true', // durationAbo: 'A vie', // hasNews: 'true', // image: 'https://i.redd.it/9nfas2kg75py.png' // }, // { // title: 'Spotify', // nom: 'LEBRUM', // prenom: 'Audrey', // sexe: 'Femme', // ville: 'Famars', // isAbo: 'false', // durationAbo: '', // hasNews: 'false', // image: 'https://upload.wikimedia.org/wikipedia/commons/thumb/2/26/Spotify_logo_with_text.svg/2000px-Spotify_logo_with_text.svg.png' // } // ]; const styles = StyleSheet.create({ fitImage: { borderRadius: 20, }, container: { flex: 1, justifyContent: 'center', backgroundColor: '#F5FCFF', }, title: { textAlign: 'center', fontSize: 22, fontWeight: '300', marginBottom: 20, }, header: { backgroundColor: '#F5FCFF', padding: 10, }, headerText: { textAlign: 'center', fontSize: 16, fontWeight: '500', }, content: { padding: 20, backgroundColor: '#fff', }, active: { backgroundColor: 'rgba(255,255,255,1)', }, inactive: { backgroundColor: 'rgba(245,252,255,1)', }, selectors: { marginBottom: 10, flexDirection: 'row', justifyContent: 'center', }, selector: { backgroundColor: '#F5FCFF', padding: 10, }, activeSelector: { fontWeight: 'bold', }, selectTitle: { fontSize: 14, fontWeight: '500', padding: 10, }, }); var update = require('react-addons-update'); class ResultScreen extends Component { state = { modalVisible: false, }; static navigationOptions = { header: () => null, }; setModalVisible(visible) { this.setState({modalVisible: visible}); } json = {}; SECTIONS = []; constructor(props) { super(props); this.setModalVisible = this.setModalVisible.bind(this); this.updateState = this.updateState.bind(this); this._renderContent = this._renderContent.bind(this) this._renderHeader = this._renderHeader.bind(this); this.render = this.render.bind(this); this.json = {}; this.SECTIONS = []; this._parseStorage(); } updateState(infoName) { let newState = {}; let scope = this; return function (value) { newState[infoName] = scope.state[infoName]; newState[infoName].value = value; scope.setState(function () { return update(scope.state, {$merge: newState} ) }); } } _renderHeader(section, index, isActive, sections) { return ( {/**/} TITRE ); } _renderContent(section, i, isActive, sections) { // let message = ""; // console.error(section); // for(var l = 0; l < section.length; l++){ // message.append(section[i]+"\n"); // } return ( test ); } _parseStorage(){ let scope = this; AsyncStorage.getItem('AwesomeProjectStorage').then(function (data) { scope.json = JSON.parse(data); let numberOfServices = Object.keys(scope.json).length; for(let index = 0; index < numberOfServices; index++){ let service = scope.json[Object.keys(scope.json)[index]]; scope.SECTIONS.push(service); //let numberOfElementsInThisService = Object.keys(this.service).length; } // console.error(numberOfElementsInThisService); // let js2 = Object.keys(service[0]); // console.error(service[0][js2[0]]); // // console.error(js+" \n "+this.json[js]+"\n") // console.error("!data: " + this.json); scope.forceUpdate(); }); } render() { // if(this.json == null){ // this.json=[]; // } if(this.SECTIONS == null){ this._parseStorage(); } return (
{ this.setModalVisible(!this.state.modalVisible); }} underlayColor={'#64b5f6'} /> } outerContainerStyles={{height: 50}} innerContainerStyles={{height: 50}} backgroundColor="white" /> { alert('Modal has been closed.'); }}> Données du téléphone Marque : {DeviceInfo.getBrand()} Nom du device : {DeviceInfo.getDeviceName()} Fournisseur : {DeviceInfo.getManufacturer()} Numéro de Téléphone : {DeviceInfo.getPhoneNumber()} Mémoire max autorisé(en bytes): {DeviceInfo.getMaxMemory()} Mémoire Total (en bytes): {DeviceInfo.getTotalMemory()} Stockage total (en bytes): {DeviceInfo.getTotalDiskCapacity()} { this.setModalVisible(!this.state.modalVisible); }} style={{ position: 'absolute', top: 10, right: 10 }}> { this.setModalVisible(!this.state.modalVisible); }} style={{ fontSize: 50, }} underlayColor={'#64b5f6'} /> ); } } export default ResultScreen