您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

add_depense.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import React from 'react';
  2. import { StyleSheet, Text, View, TextInput, Button, Pressable } from 'react-native';
  3. import { SafeAreaView } from 'react-native-safe-area-context';
  4. import DepenseForm from './depense_edit/depense_form';
  5. export default function AddDepense(props){
  6. const [addingDepense, onAddDepense] = React.useState(false);
  7. return (<SafeAreaView style={ add_depenses_styles.overlay }>
  8. <View >
  9. {addingDepense ?
  10. <DepenseForm fetchDepenses={props.fetchDepenses} onAddDepense={onAddDepense}/>
  11. : <View/>}
  12. </View>
  13. <View style={ add_depenses_styles.button_add_parent }>
  14. <Pressable
  15. style={add_depenses_styles.button_add}
  16. onPress={() => onAddDepense(!addingDepense)}>
  17. <Text>{!addingDepense ? "+" : "-"}</Text>
  18. </Pressable>
  19. </View>
  20. </SafeAreaView>
  21. );
  22. }
  23. const add_depenses_styles = StyleSheet.create({
  24. overlay: {
  25. height: "100%",
  26. width: "100%",
  27. position: 'absolute',
  28. // display:"flex",
  29. // justifyContent: "center",
  30. // elevation:10,
  31. },
  32. button_add: {
  33. borderWidth: 1,
  34. borderRadius: 25,
  35. padding: 10,
  36. backgroundColor: "#FFFFFF",
  37. elevation:5,
  38. width: "100%",
  39. height: "100%",
  40. justifyContent: 'center',
  41. alignItems: 'center',
  42. },
  43. button_add_parent: {
  44. position: 'absolute',
  45. bottom: 10,
  46. right: 10,
  47. width:50,
  48. height:50,
  49. }
  50. });