fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. // your code goes here
  13. }
  14. }
Success #stdin #stdout 0.07s 54372KB
stdin
```javascript

import React, { useState } from 'react';
import { View, Text, TextInput, Button, FlatList, StyleSheet } from 'react-native';

const App = () => {
  const [clothes, setClothes] = useState([]);
  const [currentItem, setCurrentItem] = useState({ type: '', brand: '', size: '' });

  const addClothing = () => {
    if (currentItem.type && currentItem.brand && currentItem.size) {
      setClothes([...clothes, { ...currentItem, id: Date.now().toString() }]);
      setCurrentItem({ type: '', brand: '', size: '' });
    }
  };

  const renderItem = ({ item }) => (
    <View style={styles.item}>
      <Text>{item.type} - {item.brand}: Talla {item.size}</Text>
    </View>
  );

  return (
    <View style={styles.container}>
      <Text style={styles.title}>Mi App de Tallas</Text>
      
      <TextInput
        style={styles.input}
        placeholder="Tipo de prenda"
        value={currentItem.type}
        onChangeText={(text) => setCurrentItem({ ...currentItem, type: text })}
      />
      <TextInput
        style={styles.input}
        placeholder="Marca"
        value={currentItem.brand}
        onChangeText={(text) => setCurrentItem({ ...currentItem, brand: text })}
      />
      <TextInput
        style={styles.input}
        placeholder="Talla"
        value={currentItem.size}
        onChangeText={(text) => setCurrentItem({ ...currentItem, size: text })}
      />
      
      <Button title="Añadir Prenda" onPress={addClothing} />
      
      <FlatList
        data={clothes}
        renderItem={renderItem}
        keyExtractor={item => item.id}
      />
    </View>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    padding: 20,
    backgroundColor: '#fff',
  },
  title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 20,
  },
  input: {
    height: 40,
    borderColor: 'gray',
    borderWidth: 1,
    marginBottom: 10,
    paddingHorizontal: 10,
  },
  item: {
    backgroundColor: '#f9c2ff',
    padding: 20,
    marginVertical: 8,
    marginHorizontal: 16,
  },
});

export default App;

```
stdout
Standard output is empty