|
@ -1,16 +1,20 @@ |
|
|
import React, { Component, useRef, useState } from "react"; |
|
|
import React, { Component, useRef, useState } from "react"; |
|
|
import { StyleSheet, Text, TouchableOpacity, View, CheckBox } from "react-native"; |
|
|
import { StyleSheet, Text, TouchableOpacity, View, CheckBox } from "react-native"; |
|
|
|
|
|
import { FontAwesome5 } from '@expo/vector-icons'; |
|
|
|
|
|
|
|
|
import colors from "../config/colors"; |
|
|
import colors from "../config/colors"; |
|
|
import { FlatList } from "react-native-gesture-handler"; |
|
|
import { FlatList } from "react-native-gesture-handler"; |
|
|
import { Fontisto } from '@expo/vector-icons'; |
|
|
import { Fontisto } from '@expo/vector-icons'; |
|
|
import { dimensions } from "../config/dimensions"; |
|
|
import { dimensions } from "../config/dimensions"; |
|
|
|
|
|
|
|
|
|
|
|
import { Dimensions } from "react-native"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default class DataMenu extends Component { |
|
|
export default class DataMenu extends Component { |
|
|
constructor(props) { |
|
|
constructor(props) { |
|
|
super(props); |
|
|
super(props); |
|
|
this.state = { |
|
|
this.state = { |
|
|
timeSlots: [ |
|
|
|
|
|
|
|
|
layers: [ |
|
|
{ |
|
|
{ |
|
|
id: 1, |
|
|
id: 1, |
|
|
name: 'Chuva', |
|
|
name: 'Chuva', |
|
@ -51,37 +55,41 @@ export default class DataMenu extends Component { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
render() { |
|
|
render() { |
|
|
const { timeSlots, selectedValue } = this.state; |
|
|
|
|
|
|
|
|
const screenHeight = Dimensions.get("window").height; |
|
|
|
|
|
const { layers, selectedValue } = this.state; |
|
|
return ( |
|
|
return ( |
|
|
|
|
|
|
|
|
<View style={styles.container} > |
|
|
<View style={styles.container} > |
|
|
|
|
|
|
|
|
<View style={{ flex: 0.70, backgroundColor: colors.light }}> |
|
|
|
|
|
|
|
|
<View style={{ |
|
|
|
|
|
flex: 0.70, |
|
|
|
|
|
height: screenHeight * 0.70,//solução temporária, procurar soluções pro menu se ajustar melhor ao layout
|
|
|
|
|
|
paddingTop: (screenHeight > 600 ? 0 : screenHeight * 0.09) |
|
|
|
|
|
}}> |
|
|
<FlatList |
|
|
<FlatList |
|
|
data={timeSlots} |
|
|
|
|
|
|
|
|
data={layers} |
|
|
keyExtractor={(datas) => datas.id.toString()} |
|
|
keyExtractor={(datas) => datas.id.toString()} |
|
|
renderItem={({ item }) => { |
|
|
renderItem={({ item }) => { |
|
|
const isSelected = selectedValue[item.id]; |
|
|
const isSelected = selectedValue[item.id]; |
|
|
return ( |
|
|
return ( |
|
|
<View style={{flexDirection:"row", flex: 1, marginTop: 15 }}> |
|
|
|
|
|
<View style={{flexDirection:"row", flex: 0.85}}> |
|
|
|
|
|
<Fontisto name="rain" color={colors.lightBlue} size={20}/> |
|
|
|
|
|
<Text style={styles.item}> {item.name}</Text> |
|
|
|
|
|
|
|
|
<View style={{ flexDirection: "row", flex: 1, marginTop: 15, }}> |
|
|
|
|
|
<View style={{ flexDirection: "row", flex: 0.80 }}> |
|
|
|
|
|
<Fontisto name="rain" color={colors.lightBlue} size={20} /> |
|
|
|
|
|
<Text style={styles.item}> {item.name} </Text> |
|
|
</View> |
|
|
</View> |
|
|
<View |
|
|
<View |
|
|
style={{alignSelf:"flex-end", flexDirection:"row"}}> |
|
|
|
|
|
<CheckBox |
|
|
|
|
|
value={isSelected} |
|
|
|
|
|
onChange={() => this.toggleItem(item.id)} |
|
|
|
|
|
tintColors={{ true: colors.lightBlue, false: 'black' }} |
|
|
|
|
|
/> |
|
|
|
|
|
|
|
|
style={{ flex: 0.20, alignSelf: "flex-end", flexDirection: "row" }}> |
|
|
|
|
|
<CheckBox |
|
|
|
|
|
value={isSelected} |
|
|
|
|
|
onChange={() => this.toggleItem(item.id)} |
|
|
|
|
|
tintColors={{ true: colors.lightBlue, false: 'black' }} |
|
|
|
|
|
/> |
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
</View> |
|
|
); |
|
|
); |
|
|
}} |
|
|
}} |
|
|
extraData={[selectedValue]} |
|
|
extraData={[selectedValue]} |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
<View style={styles.submit_btn}> |
|
|
<View style={styles.submit_btn}> |
|
|
<TouchableOpacity onPress={() => console.log("Aplicar camadas")}> |
|
|
<TouchableOpacity onPress={() => console.log("Aplicar camadas")}> |
|
|
<View style={styles.button}> |
|
|
<View style={styles.button}> |
|
@ -101,9 +109,9 @@ const styles = StyleSheet.create({ |
|
|
flex: 1, |
|
|
flex: 1, |
|
|
flexDirection: "row", |
|
|
flexDirection: "row", |
|
|
alignSelf: "flex-end", |
|
|
alignSelf: "flex-end", |
|
|
|
|
|
backgroundColor: colors.white, |
|
|
}, |
|
|
}, |
|
|
submit_btn: { |
|
|
submit_btn: { |
|
|
// position: "absolute",
|
|
|
|
|
|
bottom: 0, |
|
|
bottom: 0, |
|
|
width: "100%", |
|
|
width: "100%", |
|
|
padding: 20, |
|
|
padding: 20, |
|
@ -115,7 +123,6 @@ const styles = StyleSheet.create({ |
|
|
alignItems: "center", |
|
|
alignItems: "center", |
|
|
width: "100%", |
|
|
width: "100%", |
|
|
height: 42, |
|
|
height: 42, |
|
|
// marginVertical: 10,
|
|
|
|
|
|
textAlign: "center", |
|
|
textAlign: "center", |
|
|
}, |
|
|
}, |
|
|
text: { |
|
|
text: { |
|
@ -128,9 +135,6 @@ const styles = StyleSheet.create({ |
|
|
color: colors.lightBlue, |
|
|
color: colors.lightBlue, |
|
|
fontSize: dimensions.text.tertiary, |
|
|
fontSize: dimensions.text.tertiary, |
|
|
fontWeight: "bold", |
|
|
fontWeight: "bold", |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
}); |
|
|
}); |
|
|