Skip to content

Commit 5d8ce5d

Browse files
committed
Merge pull request #701 from aksonov/0.26-stable
0.26 stable
2 parents 3836299 + c04b03d commit 5d8ce5d

File tree

21 files changed

+319
-172
lines changed

21 files changed

+319
-172
lines changed

Example/Example.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,25 @@ const reducerCreate = params=>{
4646
}
4747
};
4848

49+
// define this based on the styles/dimensions you use
50+
const getSceneStyle = function (props) {
51+
return {
52+
flex: 1,
53+
marginTop: props.hideNavBar ? 0 : 64,
54+
marginBottom: props.hideTabBar ? 0 : 49.5,
55+
backgroundColor: '#fff',
56+
shadowColor: null,
57+
shadowOffset: null,
58+
shadowOpacity: null,
59+
shadowRadius: null,
60+
};
61+
}
62+
4963
export default class Example extends React.Component {
5064
render() {
51-
return <Router createReducer={reducerCreate}>
65+
return <Router createReducer={reducerCreate} getSceneStyle={getSceneStyle}>
5266
<Scene key="modal" component={Modal} >
53-
<Scene key="root" hideNavBar={true}>
67+
<Scene key="root" hideNavBar={true} hideTabBar={true}>
5468
<Scene key="echo" clone component={EchoView} />
5569
<Scene key="register" component={Register} title="Register"/>
5670
<Scene key="register2" component={Register} title="Register2" duration={1}/>
@@ -67,12 +81,12 @@ export default class Example extends React.Component {
6781
<Scene key="tab1_2" component={TabView} title="Tab #1_2" titleStyle={{color:"black"}}/>
6882
</Scene>
6983
<Scene key="tab2" initial={true} title="Tab #2" icon={TabIcon}>
70-
<Scene key="tab2_1" component={TabView} title="Tab #2_1"/>
84+
<Scene key="tab2_1" component={TabView} title="Tab #2_1" renderRightButton={()=><Right/>} />
7185
<Scene key="tab2_2" component={TabView} title="Tab #2_2" onLeft={()=>alert("Left button!")} leftTitle="Left" duration={1} panHandlers={null}/>
7286
</Scene>
7387
<Scene key="tab3" component={TabView} title="Tab #3" hideTabBar={true} icon={TabIcon}/>
7488
<Scene key="tab4" component={TabView} title="Tab #4" hideNavBar={true} icon={TabIcon}/>
75-
<Scene key="tab5" component={TabView} title="Tab #5" icon={TabIcon} renderRightButton={()=><Right/>}/>
89+
<Scene key="tab5" component={TabView} title="Tab #5" hideTabBar={true} hideNavBar={true} icon={TabIcon}/>
7690
</Scene>
7791
</Scene>
7892
</Scene>

Example/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Example App
2+
3+
Normally, after a code change to react-native-router-flux src files,
4+
you must remove the node_modules/react-native-router-flux directory
5+
and npm install. The react-native packager wont follow symlinks.
6+
7+
To assist development, this command watches and rsyncs changes:
8+
9+
```
10+
npm run sync-rnrf
11+
```
12+
13+
Leave a terminal open running this command when running the Example
14+
app and making react-native-router-flux src changes.

Example/components/EchoView.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ const styles = StyleSheet.create({
99
justifyContent: "center",
1010
alignItems: "center",
1111
backgroundColor: "#F5FCFF",
12+
borderWidth: 2,
13+
borderColor: 'red',
1214
},
1315
instructions: {
1416
textAlign: "center",
1517
color: "#333333",
1618
marginBottom: 5,
1719
},
20+
smaller: {
21+
marginBottom: 5,
22+
fontSize: 12,
23+
},
1824
});
1925

2026

@@ -24,7 +30,36 @@ export default class extends React.Component {
2430
<View style={[styles.container, this.props.sceneStyle]}>
2531
<Text style={styles.instructions}>key: {this.props.navigationState.key}</Text>
2632
<Text style={styles.instructions}>sceneKey: {this.props.navigationState.sceneKey}</Text>
27-
<Button onPress={Actions.echo}>push new scene</Button>
33+
<Button
34+
onPress={() => Actions.echo()}
35+
style={styles.smaller}
36+
>
37+
push new scene hideNavBar=inherit hideTabBar=inherit
38+
</Button>
39+
<Button
40+
onPress={() => Actions.echo({ hideNavBar: true, hideTabBar: true })}
41+
style={styles.smaller}
42+
>
43+
push new scene hideNavBar=true hideTabBar=true
44+
</Button>
45+
<Button
46+
onPress={() => Actions.echo({ hideNavBar: true, hideTabBar: false })}
47+
style={styles.smaller}
48+
>
49+
push new scene hideNavBar=true hideTabBar=false
50+
</Button>
51+
<Button
52+
onPress={() => Actions.echo({ hideNavBar: false, hideTabBar: true })}
53+
style={styles.smaller}
54+
>
55+
push new scene hideNavBar=false hideTabBar=true
56+
</Button>
57+
<Button
58+
onPress={() => Actions.echo({ hideNavBar: false, hideTabBar: false })}
59+
style={styles.smaller}
60+
>
61+
push new scene hideNavBar=false hideTabBar=false
62+
</Button>
2863
<Button onPress={Actions.pop}>pop</Button>
2964
</View>
3065
);

Example/components/Launch.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,28 @@ import Button from "react-native-button";
44
import {Actions} from "react-native-router-flux";
55

66
const styles = StyleSheet.create({
7-
container: {
8-
flex: 1,
9-
justifyContent: "center",
10-
alignItems: "center",
11-
backgroundColor: "transparent",
12-
}
7+
container: {
8+
flex: 1,
9+
justifyContent: "center",
10+
alignItems: "center",
11+
backgroundColor: "transparent",
12+
}
1313
});
1414

1515
class Launch extends React.Component {
16-
render(){
17-
return (
18-
<View {...this.props} style={styles.container}>
19-
<Text>Launch page</Text>
20-
<Button onPress={()=>Actions.login({data:"Custom data", title:"Custom title" })}>Go to Login page</Button>
21-
<Button onPress={Actions.register}>Go to Register page</Button>
22-
<Button onPress={Actions.register2}>Go to Register page without animation</Button>
23-
<Button onPress={()=>Actions.error("Error message")}>Popup error</Button>
24-
<Button onPress={Actions.tabbar}>Go to TabBar page</Button>
25-
<Button onPress={Actions.pop}>back</Button>
26-
</View>
27-
);
28-
}
16+
render(){
17+
return (
18+
<View {...this.props} style={styles.container}>
19+
<Text>Launch page</Text>
20+
<Button onPress={()=>Actions.login({data:"Custom data", title:"Custom title" })}>Go to Login page</Button>
21+
<Button onPress={Actions.register}>Go to Register page</Button>
22+
<Button onPress={Actions.register2}>Go to Register page without animation</Button>
23+
<Button onPress={()=>Actions.error("Error message")}>Popup error</Button>
24+
<Button onPress={Actions.tabbar}>Go to TabBar page</Button>
25+
<Button onPress={Actions.pop}>back</Button>
26+
</View>
27+
);
28+
}
2929
}
3030

3131
module.exports = Launch;

Example/components/NavigationDrawer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class NavigationDrawer extends React.Component {
2424
main: { opacity: Math.max(0.54, 1 - ratio) },
2525
})}
2626
>
27-
<DefaultRenderer navigationState={children[0]} />
27+
<DefaultRenderer navigationState={children[0]} onNavigate={this.props.onNavigate} />
2828
</Drawer>
2929
);
3030
}

Example/components/TabIcon.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
2-
import { PropTypes, Text } from 'react-native';
2+
import {PropTypes} from "react";
3+
import {Text} from "react-native";
34

45
const propTypes = {
56
selected: PropTypes.string,

Example/components/TabView.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
2-
import { PropTypes, StyleSheet, Text, View } from 'react-native';
2+
import {PropTypes} from "react";
3+
import {StyleSheet, Text, View} from "react-native";
34
import Button from 'react-native-button';
45
import { Actions } from 'react-native-router-flux';
56

@@ -19,13 +20,15 @@ const styles = StyleSheet.create({
1920
justifyContent: 'center',
2021
alignItems: 'center',
2122
backgroundColor: '#F5FCFF',
23+
borderWidth: 2,
24+
borderColor: 'red',
2225
},
2326
});
2427

2528
const TabView = (props, context) => {
2629
const drawer = context.drawer;
2730
return (
28-
<View style={[styles.container, props.sceneStyle]}>
31+
<View style={[styles.container, props.sceneStyle ]}>
2932
<Text>Tab {props.title}</Text>
3033
{props.name === 'tab1_1' &&
3134
<Button onPress={Actions.tab1_2}>next screen for tab1_1</Button>

Example/components/TabView2.js

Lines changed: 0 additions & 33 deletions
This file was deleted.

Example/iOS/Example.xcodeproj/project.pbxproj

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,27 +105,27 @@
105105
/* End PBXContainerItemProxy section */
106106

107107
/* Begin PBXFileReference section */
108-
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = main.jsbundle; path = main.jsbundle; sourceTree = "<group>"; };
109-
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = ../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj; sourceTree = "<group>"; };
110-
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = ../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj; sourceTree = "<group>"; };
111-
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = ../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj; sourceTree = "<group>"; };
112-
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = ../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj; sourceTree = "<group>"; };
113-
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = ../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj; sourceTree = "<group>"; };
108+
008F07F21AC5B25A0029DE68 /* main.jsbundle */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = main.jsbundle; sourceTree = "<group>"; };
109+
00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTActionSheet.xcodeproj; path = "../node_modules/react-native/Libraries/ActionSheetIOS/RCTActionSheet.xcodeproj"; sourceTree = "<group>"; };
110+
00C302B51ABCB90400DB3ED1 /* RCTGeolocation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTGeolocation.xcodeproj; path = "../node_modules/react-native/Libraries/Geolocation/RCTGeolocation.xcodeproj"; sourceTree = "<group>"; };
111+
00C302BB1ABCB91800DB3ED1 /* RCTImage.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTImage.xcodeproj; path = "../node_modules/react-native/Libraries/Image/RCTImage.xcodeproj"; sourceTree = "<group>"; };
112+
00C302D31ABCB9D200DB3ED1 /* RCTNetwork.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTNetwork.xcodeproj; path = "../node_modules/react-native/Libraries/Network/RCTNetwork.xcodeproj"; sourceTree = "<group>"; };
113+
00C302DF1ABCB9EE00DB3ED1 /* RCTVibration.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTVibration.xcodeproj; path = "../node_modules/react-native/Libraries/Vibration/RCTVibration.xcodeproj"; sourceTree = "<group>"; };
114114
00E356EE1AD99517003FC87E /* ExampleTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ExampleTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
115115
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
116116
00E356F21AD99517003FC87E /* ExampleTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ExampleTests.m; sourceTree = "<group>"; };
117-
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = ../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj; sourceTree = "<group>"; };
118-
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = ../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj; sourceTree = "<group>"; };
117+
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
118+
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
119119
13B07F961A680F5B00A75B9A /* Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
120120
13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Example/AppDelegate.h; sourceTree = "<group>"; };
121121
13B07FB01A68108700A75B9A /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Example/AppDelegate.m; sourceTree = "<group>"; };
122122
13B07FB21A68108700A75B9A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = "<group>"; };
123123
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Example/Images.xcassets; sourceTree = "<group>"; };
124124
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = Example/Info.plist; sourceTree = "<group>"; };
125125
13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = "<group>"; };
126-
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = ../node_modules/react-native/React/React.xcodeproj; sourceTree = "<group>"; };
127-
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = ../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj; sourceTree = "<group>"; };
128-
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = ../node_modules/react-native/Libraries/Text/RCTText.xcodeproj; sourceTree = "<group>"; };
126+
146833FF1AC3E56700842450 /* React.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = React.xcodeproj; path = "../node_modules/react-native/React/React.xcodeproj"; sourceTree = "<group>"; };
127+
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
128+
832341B01AAA6A8300B99B32 /* RCTText.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTText.xcodeproj; path = "../node_modules/react-native/Libraries/Text/RCTText.xcodeproj"; sourceTree = "<group>"; };
129129
/* End PBXFileReference section */
130130

131131
/* Begin PBXFrameworksBuildPhase section */
@@ -526,7 +526,6 @@
526526
runOnlyForDeploymentPostprocessing = 0;
527527
shellPath = /bin/sh;
528528
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
529-
showEnvVarsInLog = 1;
530529
};
531530
/* End PBXShellScriptBuildPhase section */
532531

@@ -618,9 +617,12 @@
618617
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
619618
"$(SRCROOT)/../node_modules/react-native/React/**",
620619
);
621-
INFOPLIST_FILE = "Example/Info.plist";
620+
INFOPLIST_FILE = Example/Info.plist;
622621
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
623-
OTHER_LDFLAGS = "-ObjC";
622+
OTHER_LDFLAGS = (
623+
"-ObjC",
624+
"-lc++",
625+
);
624626
PRODUCT_NAME = Example;
625627
};
626628
name = Debug;
@@ -634,9 +636,12 @@
634636
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
635637
"$(SRCROOT)/../node_modules/react-native/React/**",
636638
);
637-
INFOPLIST_FILE = "Example/Info.plist";
639+
INFOPLIST_FILE = Example/Info.plist;
638640
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
639-
OTHER_LDFLAGS = "-ObjC";
641+
OTHER_LDFLAGS = (
642+
"-ObjC",
643+
"-lc++",
644+
);
640645
PRODUCT_NAME = Example;
641646
};
642647
name = Release;

Example/index.ios.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { AppRegistry } from 'react-native';
22

3+
// @todo remove when RN upstream is fixed
4+
console.ignoredYellowBox = ['Warning: Failed propType: SceneView'];
5+
36
import Example from './Example';
47

58
AppRegistry.registerComponent('Example', () => Example);

0 commit comments

Comments
 (0)