Ir ao conteúdo

arthurbavi

Membro Júnior
  • Posts

    3
  • Cadastrado em

  • Última visita

Tudo que arthurbavi postou

  1. @felipecchaves import React, { Component } from 'react' import { Alert, Text, StyleSheet, View, Image, TextInput, TouchableOpacity } from 'react-native' export default class App extends Component { clicou = () => { Alert.alert("Trabalho", "Login efetuado!"); } state = { nome: '' } render() { return ( <View style={styles.container}> <Image source={require('./assets/logo.png')} style={styles.logo} /> <TextInput style={styles.input} onChangeText={ text => this.state.nome = text } placeholder="Digite seu email:" /> <TextInput style={styles.input} secureTextEntry={true} placeholder="Digite sua senha:" /> <TouchableOpacity style={styles.botao} onPress={ () => { this.props.navigation.navigate('Home', {'nome': this.state.nome}) } } > <Text style={styles.botaoText}>Login</Text> </TouchableOpacity> </View> ) } } const styles = StyleSheet.create({ container: { flex:1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#2c7a87' }, logo: { width: 150, height: 150, borderRadius: 100 }, input: { marginTop: 10, padding: 10, width: 300, backgroundColor: '#fff', fontSize: 13, fontWeight: 'bold', borderRadius: 3 }, botao:{ width: 300, height: 42, backgroundColor: '#3121db', marginTop: 10, borderRadius: 4, alignItems: 'center', justifyContent: 'center', }, botaoText:{ fontSize: 16, fontWeight: 'bold', color: '#fff' } })
  2. @felipecchaves Então no caso eu tenho que criar uma pasta components? Sou iniciante e não tenho muito conhecimento de react native. Se puder me orientar o que devo fazer agradeço muito
  3. Olá pessoal, preciso de ajuda. Estou fazendo um simples app com react native. Possui uma tela de login e eu gostaria que ao clicar no botão login, o usuário seja redirecionado para uma tela home. Porém ao clicar em login está dando o seguinte erro abaixo: Aqui o trecho do código que eu acho que pode ser o problema: <TouchableOpacity style={styles.botao} onPress={ () => { this.props.navigation.navigate('Home') } } > <Text style={styles.botaoText}>Login</Text> </TouchableOpacity> Abaixo o código do index: import React, { Component } from 'react' import { createAppContainer, createStackNavigator } from 'react-navigation'; import App from './App'; import Home from './home'; const MainNav = createStackNavigator ( { App: { screen: App, navigationOptions: { header: null } }, Home: { screen: Home, navigationOptions: { headerTitle: 'Home' } } } ) export default createAppContainer(MainNav); Não sei o que fazer, agradeço muito a quem puder ajudar. Caso necessite o código completo me avisem.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...