generator-wolmo-bootstrap-rn
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -11,2 +11,3 @@ const latestSemver = require('latest-semver'); | ||
'react-navigation', | ||
'react-navigation-redux-helpers', | ||
'react-redux', | ||
@@ -79,5 +80,5 @@ 'reactotron-apisauce', | ||
successMessage: `${dev ? 'Dev dependencies' : 'Dependencies'} ready!`, | ||
failureMessage: `${ | ||
dev ? 'Dev dependencies' : 'Dependencies' | ||
} installation failed. Turn verbose mode on for detailed logging`, | ||
failureMessage: `${dev | ||
? 'Dev dependencies' | ||
: 'Dependencies'} installation failed. Turn verbose mode on for detailed logging`, | ||
context: options | ||
@@ -84,0 +85,0 @@ }); |
@@ -1,14 +0,42 @@ | ||
import React from 'react'; | ||
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { BackHandler } from 'react-native'; | ||
import { connect } from 'react-redux'; | ||
import { addNavigationHelpers } from 'react-navigation'; | ||
import PropTypes from 'prop-types'; | ||
import { NavigationActions, addNavigationHelpers } from 'react-navigation'; | ||
import { createReduxBoundAddListener } from 'react-navigation-redux-helpers'; | ||
import { ROOT } from '../../../constants/platform'; | ||
import Navigator from '../../screens'; | ||
const AppNavigator = props => { | ||
const { dispatch, nav, ...navigatorProps } = props; | ||
return <Navigator {...navigatorProps} navigation={addNavigationHelpers({ dispatch, state: nav })} />; | ||
}; | ||
class AppNavigator extends Component { | ||
componentDidMount() { | ||
BackHandler.addEventListener('hardwareBackPress', this.onBackPress); | ||
} | ||
componentWillUnmount() { | ||
BackHandler.removeEventListener('hardwareBackPress', this.onBackPress); | ||
} | ||
onBackPress = () => { | ||
const { dispatch, nav } = this.props; | ||
if (nav.index === 0) { | ||
return false; | ||
} | ||
dispatch(NavigationActions.back()); | ||
return true; | ||
}; | ||
addListener = createReduxBoundAddListener(ROOT); | ||
render() { | ||
const { dispatch, nav, ...navigatorProps } = this.props; | ||
return ( | ||
<Navigator | ||
{...navigatorProps} | ||
navigation={addNavigationHelpers({ dispatch, state: nav, addListener: this.addListener })} | ||
/> | ||
); | ||
} | ||
} | ||
AppNavigator.propTypes = { | ||
// TODO: Declare a correct PropType for nav | ||
nav: PropTypes.any // eslint-disable-line react/forbid-prop-types | ||
@@ -15,0 +43,0 @@ }; |
import { Platform, StatusBar, Dimensions } from 'react-native'; | ||
export const ROOT = 'root'; | ||
export const isAndroid = Platform.OS === 'android'; | ||
@@ -4,0 +6,0 @@ export const isIos = Platform.OS === 'ios'; |
{ | ||
"name": "generator-wolmo-bootstrap-rn", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "files": [ |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
161210
2379
1