Browse Source

fixing a data menu issue

master
analuizaff 4 years ago
parent
commit
05d8d494a1
  1. 13
      src/app/components/FloatButton.js
  2. 5
      src/app/components/MenuItens.js
  3. 5
      src/app/context/MapDataContext.js

13
src/app/components/FloatButton.js

@ -18,7 +18,6 @@ import MenuItens from "./MenuItens";
const screenWidth = Dimensions.get("window").width; const screenWidth = Dimensions.get("window").width;
const screenHeight = Dimensions.get("window").height; const screenHeight = Dimensions.get("window").height;
console.log("-----screenHeight: " + screenHeight);
function FloatButton(props) { function FloatButton(props) {
@ -34,8 +33,11 @@ function FloatButton(props) {
toValue: value, toValue: value,
friction: 6, friction: 6,
useNativeDriver: true, useNativeDriver: true,
}).start();
}).start();
const json = JSON.stringify(context.layers);
const obj = JSON.parse(json);
setLayers(obj);
setOpen(!open); setOpen(!open);
}; };
@ -84,7 +86,6 @@ function FloatButton(props) {
const renderItem = ({ item }) => { const renderItem = ({ item }) => {
const icon = item.isSelected ? "check-box" : "check-box-outline-blank"; const icon = item.isSelected ? "check-box" : "check-box-outline-blank";
return ( return (
<MenuItens <MenuItens
item={item} item={item}
@ -111,7 +112,7 @@ function FloatButton(props) {
}}> }}>
<View style={{ <View style={{
flex: 0.05, flex: 0.05,
marginTop: screenHeight * 0.09,
marginTop: screenHeight * 0.09,
paddingBottom: 10, paddingBottom: 10,
zIndex:3, zIndex:3,
justifyContent: "center" justifyContent: "center"
@ -126,7 +127,7 @@ function FloatButton(props) {
data={layers.values} data={layers.values}
keyExtractor={(datas) => datas.id.toString()} keyExtractor={(datas) => datas.id.toString()}
renderItem={renderItem} renderItem={renderItem}
extraData={changed, open}
extraData={changed}
/> />
</View> </View>
<View style={styles.submit_btn}> <View style={styles.submit_btn}>

5
src/app/components/MenuItens.js

@ -1,6 +1,5 @@
import React, { Component, useContext, useState } from "react";
import { StyleSheet, Text, TouchableOpacity, View, Dimensions } from "react-native";
import { FontAwesome5 } from '@expo/vector-icons';
import React from "react";
import { StyleSheet, Text, TouchableOpacity, View } from "react-native";
import { MaterialIcons } from '@expo/vector-icons'; import { MaterialIcons } from '@expo/vector-icons';
import colors from "../config/colors"; import colors from "../config/colors";

5
src/app/context/MapDataContext.js

@ -64,7 +64,10 @@ const MapDataProvider = ({ children }) => {
//1/3: harcoding //1/3: harcoding
const setChanges = (data) => { const setChanges = (data) => {
layers.values = data;
const json = JSON.stringify(data);
const obj = JSON.parse(json);
layers.values = obj;
setRain(layers.values[0].isSelected); setRain(layers.values[0].isSelected);
setFlood(layers.values[1].isSelected); setFlood(layers.values[1].isSelected);
setPluviometer(layers.values[2].isSelected); setPluviometer(layers.values[2].isSelected);

Loading…
Cancel
Save