aksonov / aksonov/react-native-redux-router

How to call this.props.dispatch from within function

Aperta
#17 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
404
Fork
44
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Hey @aksonov ,
first of great library! I will preface this with that I am a bit of a noob with react-native.

I was wondering how I would achieve calling the dispatch from within a function in my component.

```
import React, {Component} from 'react';
import {StyleSheet,Text,TouchableHighlight,View} from 'react-native';
import {Actions} from 'react-native-redux-router';

class Activity extends React.Component{
propTypes: {
style: View.propTypes.style
}
_onButtonPress(){
return this.props.dispatch(Actions.activity);
}
render() {
return (
this._onButtonPress()}>
Activity

);
}
}
export default (Activity);
```

If I try to do this I get "Actions must be plain object" error, naturally since Actions.activity is a function.

Thanks in advance.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.