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

add_depense.js 1.2KB

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