aksonov / aksonov/react-native-redux-router

How to call this.props.dispatch from within function

Offen
#17 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
404
Forks
44
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.