javascript - react-native with react-navigation and redux [transfer state across screen] -


i new react-native , libraries.

i trying inputtext's content across next screen using react-redux, not sure how properly. documentations verbose explain theories nothing practical.

i have 2 screens in stacknavigator follows:

const stacknav = stacknavigator({   signname: { screen: signnamescreen},   signbday: { screen: signbdayscreen} }) 

each of signnamescreen , signbdayscreen has textinput , want user input across screen.

class signnamescreen extends component {   static navigationoptions = {     title: 'welcome',   };   handlenext() {     alert.alert("handle button next pressed") //     navigate("signbday")   }   handleonpress() {     alert.alert("handle button login pressed")   }   submitfunc = () => {     const payload = {       email: this.email,       password: this.password     }     console.log(payload)     alert.alert("hello: " + payload.email)   }   render() {     return (       <view style={{flex: 1, flexdirection: 'column', justifycontent:  'space-around'}}>         <textinput placeholder="first name"           onchangetext={(text) => this.firstname = text}/>         <textinput placeholder="last name"           onchangetext={(text) => this.lastname = text}/>       <button          title="next" //         onpress={this.handlenext} // doesnt work, function cannot access props         onpress={() => {this.props.navigation.navigate("signbday")}}       />       </view>     );   } } 

i tried various methods creating reducer, export class using connect etc, breaks code. point me in right direction, please?

i have tried numerous sample project github either unbuildable or unrunnable because of various node problems.. sorry, javascript weak point too.

thanks lot help.

the screenshot

navigate

onpress={() => this.props.navigation.navigate('signbday', { 'param_name': 'param_value' })} 

then param in screen this

const { params } = this.props.navigation.state; 

to value of parameter in next screen use

params.param_name 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -