



Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!




import React from "react"; import { Button, StyleSheet, Text, TextInput, View, SafeAreaView, } from "react-native"; import { CustomButton } from "./src/components/CustomButton"; import InputField from "./src/components/InputField";
// render 2 // constructor 1 // componentDidMount 3 // componentWillUnmount 5 Quando viene dismesso // componentDidUpdate 4 Ma ogni volta che il render si aggiorna
export default class ClassApp extends React.Component { constructor(props) { super(props); this.state = { label: "CIAO", title: "BUTTON", disabled: false, input: "TESTO", }; }
componentDidMount() { setTimeout(() => { this.setState({ title: "NOTTUB" }); }, 4000); }
onPress = () => { console.log("onPress"); };
onChangeText = (text) => { this.setState({ input: text }); };
render() { return (
componentWillUnmount() {}
componentDidUpdate(prevProps, prevState) { console.log("componentDidUpdate", this.state.input); } }
//stile del bottone const styles = StyleSheet.create({ container: { alignItems: 'center', backgroundColor: 'red', shadowColor: "#000", shadowOffset: { width: 0, height: 3, }, shadowOpacity: 0.29, shadowRadius: 4.65, elevation: 7, padding: 10, borderRadius: 10, }, });
import React, { Component } from 'react'; import {TextInput, StyleSheet} from "react-native";
class InputField extends Component { render() { return ( <TextInput onChangeText={this.props.onChangeText} value={this.props.value} style={[styles.input, this.props.style]} placeholder={this.props.placeholder} secureTextEntry={this.props.isSecure} /> ); } }
const styles = StyleSheet.create({ input: { height: 50, borderWidth: 1, borderRadius: 8,
fontSize: 16, paddingHorizontal: 16, } });
export default InputField;