Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// @ts-ignore
)
}
}
const WithForwardRef = React.forwardRef((props: WithSafeNavigationProps, ref) => (
))
WithForwardRef.displayName = `ForwardRef(WithSafeNavigation)`
return withNavigation(WithForwardRef)
}
export default function createNavigationAwareScrollable(Component: any) {
const ComponentWithNavigationScrolling = withNavigation(
class extends React.PureComponent {
static displayName = `withNavigationScrolling(${Component.displayName ||
Component.name})`;
_subscription: any;
componentDidMount() {
this._subscription = this.props.navigation.addListener(
'refocus',
() => {
const scrollableNode = this.getNode();
if (this.props.navigation.isFocused() && scrollableNode !== null) {
if (scrollableNode.scrollToTop != null) {
scrollableNode.scrollToTop();
} else if (scrollableNode.scrollTo != null) {
scrollableNode.scrollTo({ y: 0 });
return (
);
}
}
const FocusTag = withNavigation(FocusTagWithNav);
class SampleScreen extends React.Component {
static navigationOptions = ({ navigation }) => ({
title: 'Lorem Ipsum',
headerRight: navigation.getParam('nextPage') ? (
<button title="Next"> navigation.navigate(navigation.getParam('nextPage'))}
/>
) : null,
});
componentDidMount() {
this.props.navigation.addListener('refocus', () => {
if (this.props.navigation.isFocused()) {
this.scrollView.scrollTo({ x: 0, y: 0 });</button>
? `/${pathAndParams.path}?${queryString.stringify(pathAndParams.params)}`
: `/${pathAndParams.path}`;
return (
<a href="{href}"> {
navigation.dispatch(navAction);
e.preventDefault();
}}
>
{children}
</a>
);
}
}
const Link = withNavigation(LinkWithNavigation);
export default Link;