rn-push
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -64,2 +64,3 @@ import React from "react"; | ||
{React.cloneElement(this.props.children, { | ||
pushState: this.state.show, | ||
push: params => { | ||
@@ -66,0 +67,0 @@ this.propsToPass = params.passProps; |
{ | ||
"name": "rn-push", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -71,1 +71,32 @@ # React Native simplest push from right transition | ||
``` | ||
Component that you push from receieves `pushState` prop. You can do something like this: | ||
```js | ||
class Screen extends Component { | ||
componentWillReceiveProps(props) { | ||
if (props.pushState === false) { | ||
// do something when user goes back | ||
// ie. fetch data to update Your view or something like that | ||
} | ||
} | ||
render() { | ||
return ( | ||
<View> | ||
<Button | ||
title="Next" | ||
onPress={() => | ||
props.push({ | ||
component: Screen2, | ||
passProps: { | ||
title: "Previous" | ||
} | ||
}) | ||
} | ||
/> | ||
</View> | ||
); | ||
} | ||
} | ||
``` |
6356
124
102