Skip to content
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

Babel v7, ESlint fixes, React/React Navigation upgrades, mobx removed #3142

Merged
Merged
Show file tree
Hide file tree
Changes from 14 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
8 changes: 0 additions & 8 deletions .babelrc

This file was deleted.

7 changes: 6 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ jobs:
build:
working_directory: ~/react-native-router-flux
docker:
- image: circleci/node:7
- image: circleci/node:8
steps:
- run:
name: temporary-eslint-airbnb-config-install
command: |
git clone https://github.com/airbnb/javascript.git ~/airbnb-style
cd ~/airbnb-style/ && yarn install
- checkout
- restore_cache:
key: dependency-cache-{{ checksum "package.json" }}
Expand Down
8 changes: 0 additions & 8 deletions Example/.babelrc

This file was deleted.

14 changes: 9 additions & 5 deletions Example/Example.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import React from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
import {
Platform, StyleSheet, Text, View,
} from 'react-native';
import CardStackStyleInterpolator from 'react-navigation/src/views/StackView/StackViewStyleInterpolator';
import {
Scene, Router, Actions, Reducer, ActionConst, Overlay, Tabs, Modal, Drawer, Stack, Lightbox,
} from 'react-native-router-flux';
import Launch from './components/Launch';
import Register from './components/Register';
import Login from './components/Login';
import Login2 from './components/Login2';
import Login3 from './components/Login3';
import CardStackStyleInterpolator from 'react-navigation/src/views/StackView/StackViewStyleInterpolator';
import { Scene, Router, Actions, Reducer, ActionConst, Overlay, Tabs, Modal, Drawer, Stack, Lightbox } from 'react-native-router-flux';
import Home from './components/Home';
import DrawerContent from './components/drawer/DrawerContent';
import TabView from './components/TabView';
Expand Down Expand Up @@ -35,7 +39,7 @@ const styles = StyleSheet.create({
},
});

const reducerCreate = params => {
const reducerCreate = (params) => {
const defaultReducer = new Reducer(params);
return (state, action) => {
console.log('ACTION:', action);
Expand Down Expand Up @@ -68,7 +72,7 @@ const Example = () => (
<Scene key="customNavBar1" title="CustomNavBar 1" navBar={CustomNavBar} component={CustomNavBarView} back />
<Scene key="customNavBar2" title="CustomNavBar 2" navBar={CustomNavBar} component={CustomNavBarView} back />
<Scene key="customNavBar3" title="Another CustomNavBar" navBar={CustomNavBar2} component={CustomNavBarView} back />
<Scene key="hiddenNavBar" title="hiddenNavBar" component={CustomNavBarView} hideNavBar={true} back />
<Scene key="hiddenNavBar" title="hiddenNavBar" component={CustomNavBarView} hideNavBar back />
</Stack>

<Stack back backTitle="Back" key="register" duration={0} navTransparent>
Expand Down
9 changes: 9 additions & 0 deletions Example/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
presets: [
'react-native',
'module:metro-react-native-babel-preset',
],
plugins: [
['@babel/plugin-proposal-decorators', { legacy: true }],
],
};
86 changes: 47 additions & 39 deletions Example/components/CustomNavBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Image, Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import React from 'react'
import { Actions } from 'react-native-router-flux'
import {
Image, Platform, StyleSheet, Text, TouchableOpacity, View,
} from 'react-native';
import React from 'react';
import { Actions } from 'react-native-router-flux';

const styles = StyleSheet.create({
container: {
Expand All @@ -10,12 +12,11 @@ const styles = StyleSheet.create({
},
navBarItem: {
flex: 1,
justifyContent: 'center'
}
})
justifyContent: 'center',
},
});

export default class CustomNavBar extends React.Component {

// constructor(props) {
// super(props)
// }
Expand All @@ -25,72 +26,79 @@ export default class CustomNavBar extends React.Component {
return (
<TouchableOpacity
onPress={() => console.log('Hamburger button pressed')}
style={[styles.navBarItem, { paddingLeft: 10}]}>
style={[styles.navBarItem, { paddingLeft: 10 }]}
>
<Image
style={{width: 30, height: 50}}
style={{ width: 30, height: 50 }}
resizeMode="contain"
source={{uri: 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Hamburger_icon.svg/1200px-Hamburger_icon.svg.png'}}></Image>
source={{ uri: 'https://upload.wikimedia.org/wikipedia/commons/thumb/b/b2/Hamburger_icon.svg/1200px-Hamburger_icon.svg.png' }}
/>
</TouchableOpacity>
)
} else {
return (
<TouchableOpacity
onPress={Actions.pop}
style={[styles.navBarItem, { paddingLeft: 10}]}>
<Image
style={{width: 30, height: 50}}
resizeMode="contain"
source={{uri: 'https://image.flaticon.com/icons/png/512/0/340.png'}}></Image>
</TouchableOpacity>
)
);
}
return (
<TouchableOpacity
onPress={Actions.pop}
style={[styles.navBarItem, { paddingLeft: 10 }]}
>
<Image
style={{ width: 30, height: 50 }}
resizeMode="contain"
source={{ uri: 'https://image.flaticon.com/icons/png/512/0/340.png' }}
/>
</TouchableOpacity>
);
}

_renderMiddle() {
return (
<View style={styles.navBarItem}>
<Text>{ this.props.title }</Text>
</View>
)
);
}

_renderRight() {
return (
<View style={[styles.navBarItem, { flexDirection: 'row', justifyContent: 'flex-end' }]}>
<TouchableOpacity
onPress={() => console.log('Share')}
style={{ paddingRight: 10}}>
style={{ paddingRight: 10 }}
>
<Image
style={{width: 30, height: 50}}
style={{ width: 30, height: 50 }}
resizeMode="contain"
source={{uri: 'https://cdn3.iconfinder.com/data/icons/glypho-free/64/share-512.png'}}></Image>
source={{ uri: 'https://cdn3.iconfinder.com/data/icons/glypho-free/64/share-512.png' }}
/>
</TouchableOpacity>
<TouchableOpacity
onPress={() => console.log('Search')}
style={{ paddingRight: 10 }}>
style={{ paddingRight: 10 }}
>
<Image
style={{width: 30, height: 50}}
style={{ width: 30, height: 50 }}
resizeMode="contain"
source={{uri: 'https://maxcdn.icons8.com/Share/icon/p1em/Very_Basic//search1600.png'}}></Image>
source={{ uri: 'https://maxcdn.icons8.com/Share/icon/p1em/Very_Basic//search1600.png' }}
/>
</TouchableOpacity>
</View>
)
);
}

render() {
let dinamicStyle = {}
let dinamicStyle = {};
if (Actions.currentScene === 'customNavBar1') {
dinamicStyle = { backgroundColor: 'red'}
dinamicStyle = { backgroundColor: 'red' };
} else {
dinamicStyle = { backgroundColor: 'yellow'}
dinamicStyle = { backgroundColor: 'yellow' };
}

return (
<View style={[styles.container, dinamicStyle]}>
{ this._renderLeft() }
{ this._renderMiddle() }
{ this._renderRight() }
</View>
)
<View style={[styles.container, dinamicStyle]}>
{ this._renderLeft() }
{ this._renderMiddle() }
{ this._renderRight() }
</View>
);
}
}
37 changes: 20 additions & 17 deletions Example/components/CustomNavBar2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Image, Platform, StyleSheet, Text, TouchableOpacity, View } from 'react-native'
import React from 'react'
import { Actions } from 'react-native-router-flux'
import {
Image, Platform, StyleSheet, Text, TouchableOpacity, View,
} from 'react-native';
import React from 'react';
import { Actions } from 'react-native-router-flux';

const styles = StyleSheet.create({
container: {
Expand All @@ -11,12 +13,11 @@ const styles = StyleSheet.create({
},
navBarItem: {
flex: 1,
justifyContent: 'center'
}
})
justifyContent: 'center',
},
});

export default class CustomNavBar extends React.Component {

// constructor(props) {
// super(props)
// }
Expand All @@ -25,29 +26,31 @@ export default class CustomNavBar extends React.Component {
return (
<TouchableOpacity
onPress={Actions.pop}
style={[styles.navBarItem, { paddingLeft: 10}]}>
style={[styles.navBarItem, { paddingLeft: 10 }]}
>
<Image
style={{width: 30, height: 50}}
style={{ width: 30, height: 50 }}
resizeMode="contain"
source={{uri: 'https://image.flaticon.com/icons/png/512/0/340.png'}}></Image>
source={{ uri: 'https://image.flaticon.com/icons/png/512/0/340.png' }}
/>
</TouchableOpacity>
)
);
}

_renderMiddle() {
return (
<View style={styles.navBarItem}>
<Text>{ this.props.title }</Text>
</View>
)
);
}

render() {
return (
<View style={styles.container}>
{ this._renderLeft() }
{ this._renderMiddle() }
</View>
)
<View style={styles.container}>
{ this._renderLeft() }
{ this._renderMiddle() }
</View>
);
}
}
8 changes: 5 additions & 3 deletions Example/components/CustomNavBarView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import PropTypes from 'prop-types';
import {StyleSheet, Text, View, ViewPropTypes} from 'react-native';
import {
StyleSheet, Text, View, ViewPropTypes,
} from 'react-native';
import Button from 'react-native-button';
import { Actions } from 'react-native-router-flux';

Expand All @@ -24,9 +26,9 @@ const styles = StyleSheet.create({
class TabView extends React.Component {
render() {
return (
<View style={[styles.container, this.props.sceneStyle ]}>
<View style={[styles.container, this.props.sceneStyle]}>
<Button onPress={Actions.pop}>Back</Button>
<Button onPress={() => Actions.replace('launch') }>Welcome Page</Button>
<Button onPress={() => Actions.replace('launch')}>Welcome Page</Button>
<Button onPress={() => { Actions.customNavBar1(); }}>Switch to Scene with CustomNavBar #1</Button>
<Button onPress={() => { Actions.customNavBar2(); }}>Switch to Scene with CustomNavBar #2</Button>
<Button onPress={() => { Actions.customNavBar3(); }}>Switch to Scene with different CustomNavBar </Button>
Expand Down
56 changes: 28 additions & 28 deletions Example/components/EchoView.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import React from 'react';
import {View, Text, StyleSheet} from "react-native";
import Button from "react-native-button";
import {Actions} from "react-native-router-flux";
import { View, Text, StyleSheet } from 'react-native';
import Button from 'react-native-button';
import { Actions } from 'react-native-router-flux';

const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "#F5FCFF",
borderWidth: 2,
borderColor: 'red',
},
instructions: {
textAlign: "center",
color: "#333333",
marginBottom: 5,
},
smaller: {
marginBottom: 5,
fontSize: 12,
},
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
borderWidth: 2,
borderColor: 'red',
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
smaller: {
marginBottom: 5,
fontSize: 12,
},
});


export default class extends React.Component {
onEnter() {
console.log('EchoView onEnter');
}
render(){
return (
<View style={[styles.container, this.props.sceneStyle]}>
<Text style={styles.instructions}>routeName: {this.props.name}</Text>
<Button onPress={Actions.pop}>pop</Button>
</View>
);

render() {
return (
<View style={[styles.container, this.props.sceneStyle]}>
<Text style={styles.instructions}>routeName: {this.props.name}</Text>
<Button onPress={Actions.pop}>pop</Button>
</View>
);
}
}

Loading