12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import React, { useState } from 'react';
- import {View, Text, TextInput, StyleSheet} from 'react-native';
- export default function ActionEditor(props) {
- let [action, setAction] = useState(props.value || {});
- if(!action.data || typeof action.data !== "object") action.data = {};
- return (
- <View style={styles.container}>
- <Text>{props.title}</Text>
- <View style={styles.row}>
- <Text style={[styles.title, styles.capFirst]}>Type</Text>
- <TextInput style={styles.defaultInput}
- onChangeText={(text) => {
- action.type = text;
- props.onChange && props.onChange(action);
- setAction(action);
- }}
- value={action.type}/>
- </View>
- <View style={styles.row}>
- <Text style={[styles.title, styles.capFirst]}>Data</Text>
- <TextInput style={styles.defaultInput}
- onChangeText={(text) => {
- action.data.route = text;
- props.onChange && props.onChange(action);
- setAction(action);
- }}
- value={action.data.route}/>
- </View>
- </View>
- );
- }
- const styles = StyleSheet.create({
- container:{
- flexDirection: 'column',
- borderBottomWidth: 1,
- borderColor: '#cecece'
- },
- row: {
- flexDirection: 'row',
- alignItems: 'baseline',
- justifyContent: 'space-between',
- },
- capFirst: {
- fontSize: 14,
- fontFamily: 'roboto-light',
- textTransform: 'capitalize'
- },
- defaultInput: {
- marginTop:6,
- borderWidth:1,
- backgroundColor: 'white',
- boxShadow: '0px 3px 6px #00000029',
- borderColor: '#FFFFFF66',
- borderRadius: 14
- },
- title: {
- }
- })
|