import React, { Component } from 'react'; import { StyleSheet, TextInput, View, Alert, TouchableOpacity, Text, ScrollView, Platform,Picker} from 'react-native'; import DatePicker from 'react-native-datepicker'; import RNPickerSelect, { defaultStyles } from 'react-native-picker-select'; const food=[{label:'food',value:'food'},{label:'not food',value:'notfood'}]; export default class Product extends Component { constructor(props) { super(props) this.state = { uid:'1234', lid:'5678', name_p: '', bought_date:'', expiration_date:'', type:'fresh', quantity:'', notes:'', renew:'1', picked:'no' } } insertList_Function = () => { this.setState({ picked: "yes" }) fetch('https://ada.uprrp.edu/~laura.gonzalez19/4030/insert_productsss.php', { method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', }, body: JSON.stringify({ name_p: this.state.name_p, lid: this.state.lid, uid: this.state.uid, bought_date:this.state.bought_date, expiration_date:this.state.expiration_date, type:this.state.type, quantity:this.state.quantity, renew:this.state.renew, notes:this.state.notes, }) }).then((response) => response.json()) .then((responseJson) => { // Showing response message coming from server after inserting records. Alert.alert(responseJson); }); } render() { return ( Add Products! this.setState({ name_p: data })} underlineColorAndroid='transparent' style={styles.TextInputStyleClass} /> this.setState({bought_date:data}) } /> this.setState({expiration_date:data}) } /> this.setState({quantity: text})} value = {this.state.quantity} /> this.setState({ notes: data })} underlineColorAndroid='transparent' style={styles.TextInputStyleClass} /> this.setState({type: itemValue})} style={pickerSelectStyles} useNativeAndroidPickerStyle={false} /> this.setState({renew: itemValue})} style={pickerSelectStyles} useNativeAndroidPickerStyle={false} /> + Start adding your products ); } } const styles = StyleSheet.create({ MainContainer: { justifyContent: 'center', alignItems: 'center', flex: 1, margin: 10 }, TextInputStyleClass: { color: 'gray', textAlign: 'center', marginBottom: 7, height: 40, width: '80%', borderWidth: 1, borderColor: '#3414B3' }, button: { height:50, width: 50, paddingTop: 2, paddingBottom: 2, backgroundColor: '#3414B3', borderRadius: 100, marginTop: 20 }, text: { color: '#fff', fontSize: 32, textAlign: 'center', padding: 0 }, } ); const pickerSelectStyles = StyleSheet.create({ inputIOS: { fontSize: 16, borderWidth: 1, paddingVertical: 12, paddingHorizontal: 10, borderColor: '#3414B3', color: 'gray', marginTop: 20, paddingRight: 30, // to ensure the text is never behind the icon }, inputAndroid: { justifyContent: 'center', borderWidth: 1, alignItems: 'center', fontSize: 16, paddingHorizontal: 10, paddingVertical: 8, paddingTop: 2, paddingBottom: 2, borderColor: '#3414B3', marginBottom: 7, height: 40, width: 270, color: 'gray', paddingRight: 30, // to ensure the text is never behind the icon }, });