ModuleEditor.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React, { useState } from 'react';
  2. import {View, Text, TextInput, StyleSheet} from 'react-native';
  3. export default function ModuleEditor(props) {
  4. let [module, setModule] = useState(props.value || {});
  5. return (
  6. <View style={styles.container}>
  7. <View style={styles.row}>
  8. <Text style={[styles.title, styles.capFirst]}>Module</Text>
  9. <TextInput style={styles.defaultInput}
  10. onChangeText={(text) => {
  11. module.value = text;
  12. props.onChange && props.onChange(module);
  13. setModule(module);
  14. }}
  15. value={module.value}/>
  16. </View>
  17. <View style={styles.row}>
  18. <Text style={[styles.title, styles.capFirst]}>Namespace</Text>
  19. <TextInput style={styles.defaultInput}
  20. onChangeText={(text) => {
  21. module.namespace = text;
  22. props.onChange && props.onChange(module);
  23. setModule(module);
  24. }}
  25. value={module.namespace}/>
  26. </View>
  27. </View>
  28. );
  29. }
  30. const styles = StyleSheet.create({
  31. container:{
  32. flexDirection: 'column'
  33. },
  34. row: {
  35. flexDirection: 'row',
  36. alignItems: 'baseline',
  37. justifyContent: 'space-between',
  38. },
  39. capFirst: {
  40. fontSize: 14,
  41. fontFamily: 'roboto-light',
  42. textTransform: 'capitalize'
  43. },
  44. defaultInput: {
  45. marginTop:6,
  46. borderWidth:1,
  47. backgroundColor: 'white',
  48. boxShadow: '0px 3px 6px #00000029',
  49. borderColor: '#FFFFFF66',
  50. borderRadius: 14
  51. },
  52. title: {
  53. }
  54. })