Comparing version 2.0.0 to 2.0.1
28
index.js
import React from "react"; | ||
import { View, Animated, ScrollView, Dimensions, BackHandler } from "react-native"; | ||
import { | ||
View, | ||
Animated, | ||
ScrollView, | ||
Dimensions, | ||
BackHandler | ||
} from "react-native"; | ||
@@ -13,13 +19,9 @@ const window = Dimensions.get("window"); | ||
componentDidMount() { | ||
BackHandler.addEventListener('hardwareBackPress', () => { | ||
BackHandler.addEventListener("hardwareBackPress", () => { | ||
if (this.state.show && this.scrollView) { | ||
this.scrollView._component.scrollTo({ x: 0 }) | ||
this.scrollView._component.scrollTo({ x: 0 }); | ||
return true; | ||
} | ||
return false; | ||
}) | ||
}); | ||
} | ||
@@ -116,6 +118,8 @@ | ||
> | ||
{React.createElement(this.component, { | ||
...this.propsToPass, | ||
pop: () => this.scrollView._component.scrollTo({ x: 0 }) | ||
})} | ||
<Push> | ||
{React.createElement(this.component, { | ||
...this.propsToPass, | ||
pop: () => this.scrollView._component.scrollTo({ x: 0 }) | ||
})} | ||
</Push> | ||
</View> | ||
@@ -122,0 +126,0 @@ </Animated.ScrollView> |
{ | ||
"name": "rn-push", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"main": "index.js", | ||
@@ -5,0 +5,0 @@ "private": false, |
@@ -5,3 +5,3 @@ # React Native simplest push from right transition | ||
<img src="https://thumbs.gfycat.com/DependentForsakenAustraliancurlew-size_restricted.gif" /> | ||
<img src="https://thumbs.gfycat.com/DependentForsakenAustraliancurlew-size_restricted.gif" /> | ||
@@ -32,3 +32,3 @@ ## Why would You use this library? | ||
This component takes a single children and passes a `push` prop to it. Component that You will push to will receive `pop` prop. | ||
This component takes a single children and passes a `push` prop to it. Component that You will push to will receive `pop` prop. You can push deeper from the screen that is already pushed. | ||
@@ -35,0 +35,0 @@ ```js |
5684
123