Skip to content

Support newer RN versions #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions lib/NavBar.android.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
/* @flow */

import React from 'react'
import { StyleSheet } from 'react-native'
import CustomComponents from 'react-native-deprecated-custom-components'
import React from 'react';
import { StyleSheet } from 'react-native';
import CustomComponents from 'react-native-deprecated-custom-components';

const stylesAndroid = StyleSheet.create({
navBar: {
backgroundColor: '#f5f5f5',
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
justifyContent: 'center'
}
})
});

class NavBar extends React.Component {
updateProgress (progress, fromIndex, toIndex) {
updateProgress(progress, fromIndex, toIndex) {
this._nav.updateProgress(progress, fromIndex, toIndex);
}

render () {
render() {
return (
<CustomComponents.Navigator.NavigationBar
style={[stylesAndroid.navBar, this.props.style]}
routeMapper={this.props.routeMapper}
navState={this.props.navState}
navigator={this.props.navigator}
ref={nav => { this._nav = nav }}
ref={nav => {
this._nav = nav;
}}
/>
)
);
}
}

NavBar.propTypes = {
...CustomComponents.Navigator.NavigationBar.propTypes,
}
...CustomComponents.Navigator.NavigationBar.propTypes
};

export default NavBar
export default NavBar;
28 changes: 15 additions & 13 deletions lib/NavBar.ios.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
/* @flow */

import React from 'react'
import { StyleSheet, PixelRatio } from 'react-native'
import CustomComponents from 'react-native-deprecated-custom-components'
import React from 'react';
import { StyleSheet, PixelRatio } from 'react-native';
import CustomComponents from 'react-native-deprecated-custom-components';

class NavBar extends React.Component {
updateProgress (progress, fromIndex, toIndex) {
updateProgress(progress, fromIndex, toIndex) {
this._nav.updateProgress(progress, fromIndex, toIndex);
}

render () {
render() {
return (
<CustomComponents.Navigator.NavigationBar
style={[styles.navBar, this.props.style]}
routeMapper={this.props.routeMapper}
navState={this.props.navState}
navigator={this.props.navigator}
ref={nav => { this._nav = nav }}
ref={nav => {
this._nav = nav;
}}
/>
)
);
}
}

NavBar.propTypes = {
...CustomComponents.Navigator.NavigationBar.propTypes,
}
...CustomComponents.Navigator.NavigationBar.propTypes
};

const styles = StyleSheet.create({
navBar: {
backgroundColor: 'white',
borderBottomWidth: 1 / PixelRatio.get(),
borderColor: '#8e8e93',
},
})
borderColor: '#8e8e93'
}
});

export default NavBar
export default NavBar;
19 changes: 10 additions & 9 deletions lib/NavBarBackButton.android.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
/* @flow */

import React, { PropTypes } from 'react'
import React from 'react'
import PropTypes from 'prop-types'
import { TouchableOpacity, Text, StyleSheet } from 'react-native'
import Ionicon from 'react-native-vector-icons/Ionicons'

class NavBarBackButton extends React.Component {
static propTypes = {
...TouchableOpacity.propTypes,
tintColor: PropTypes.string,
children: PropTypes.string.isRequired,
style: Text.propTypes.style,
showBackTitle: PropTypes.bool,
}

constructor (props) {
super(props)
this.state = {
Expand Down Expand Up @@ -41,14 +50,6 @@ class NavBarBackButton extends React.Component {
}
}

NavBarBackButton.propTypes = {
...TouchableOpacity.propTypes,
tintColor: PropTypes.string,
children: PropTypes.string.isRequired,
style: Text.propTypes.style,
showBackTitle: PropTypes.bool,
}

const styles = StyleSheet.create({
container: {
flexDirection: 'row',
Expand Down
27 changes: 16 additions & 11 deletions lib/NavBarBackButton.ios.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
/* @flow */

import React, { PropTypes } from 'react'
import React from 'react'
import PropTypes from 'prop-types'
import { TouchableOpacity, Text, StyleSheet } from 'react-native'
import Ionicon from 'react-native-vector-icons/Ionicons'

class NavBarBackButton extends React.Component {
state: Object;
type State = {
tintColor: String
}

class NavBarBackButton extends React.Component<any, State> {
state: State

static propTypes = {
...TouchableOpacity.propTypes,
tintColor: PropTypes.string,
children: PropTypes.string.isRequired,
style: Text.propTypes.style,
showBackTitle: PropTypes.bool,
}

constructor (props: Object) {
super(props)
Expand Down Expand Up @@ -43,14 +56,6 @@ class NavBarBackButton extends React.Component {
}
}

NavBarBackButton.propTypes = {
...TouchableOpacity.propTypes,
tintColor: PropTypes.string,
children: PropTypes.string.isRequired,
style: Text.propTypes.style,
showBackTitle: PropTypes.bool,
}

const styles = StyleSheet.create({
container: {
flexDirection: 'row',
Expand Down
3 changes: 2 additions & 1 deletion lib/NavigatorWrapper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import React, { PropTypes } from 'react'
import React from 'react'
import PropTypes from 'prop-types'
import {
View,
BackAndroid,
Expand Down
3 changes: 2 additions & 1 deletion lib/TopNavigatorWrapper.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */

import React, { PropTypes } from 'react'
import React from 'react'
import PropTypes from 'prop-types'
import { View, Platform } from 'react-native'
import NavigatorWrapper from './NavigatorWrapper'
import { defaultRouteMapper } from './RouteMapper'
Expand Down
26 changes: 26 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@
"prettier": "^1.3.0"
},
"dependencies": {
"@types/prop-types": "^15.5.2",
"@types/react-native": "^0.49.2",
"prop-types": "^15.6.0",
"react-native": "^0.49.3",
"react-native-deprecated-custom-components": "^0.1.0",
"react-native-vector-icons": "^4.0.1"
}
}
}
Loading