Skip to content

Commit f44d50c

Browse files
committed
Merge pull request #538 from aksonov/revert-536-feature/react-native-24
Revert "[WIP] Get Example app working with React 0.24+ "
2 parents d0ff592 + 55bb2d2 commit f44d50c

File tree

8 files changed

+23
-136
lines changed

8 files changed

+23
-136
lines changed

Example/.buckconfig

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

Example/.flowconfig

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@
4242
# Ignore Website
4343
.*/website/.*
4444

45-
# Ignore generators
46-
.*/local-cli/generator.*
47-
48-
# Ignore BUCK generated folders
49-
.*\.buckd/
50-
5145
.*/node_modules/is-my-json-valid/test/.*\.json
5246
.*/node_modules/iconv-lite/encodings/tables/.*\.json
5347
.*/node_modules/y18n/test/.*\.json
@@ -65,7 +59,6 @@
6559
.*/node_modules/isemail/.*\.json
6660
.*/node_modules/tr46/.*\.json
6761

68-
6962
[include]
7063

7164
[libs]
@@ -93,4 +86,4 @@ suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-2]\\|1[0-9]\\|[0-9
9386
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
9487

9588
[version]
96-
^0.22.0
89+
0.22.0

Example/.gitignore

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,3 @@ local.properties
3232
#
3333
node_modules/
3434
npm-debug.log
35-
36-
# BUCK
37-
buck-out/
38-
\.buckd/
39-
android/app/libs
40-
android/keystores/debug.keystore

Example/Example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export default class Example extends React.Component {
5959
<Scene key="loginModal" component={Login} title="Login"/>
6060
<Scene key="loginModal2" hideNavBar={true} component={Login2} title="Login2" panHandlers={null} duration={1}/>
6161
</Scene>
62-
<Scene key="tabbar" component={NavigationDrawer} panHandlers={null}>
62+
<Scene key="tabbar" component={NavigationDrawer}>
6363
<Scene key="main" tabs={true} >
6464
<Scene key="tab1" title="Tab #1" icon={TabIcon} navigationBarStyle={{backgroundColor:"red"}} titleStyle={{color:"white"}}>
6565
<Scene key="tab1_1" component={TabView} title="Tab #1_1" onRight={()=>alert("Right button")} rightTitle="Right" />

Example/android/app/BUCK

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

Example/android/app/build.gradle

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import com.android.build.OutputFile
99
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
1010
* bundle directly from the development server. Below you can see all the possible configurations
1111
* and their defaults. If you decide to add a configuration block, make sure to add it before the
12-
* `apply from: "../../node_modules/react-native/react.gradle"` line.
12+
* `apply from: "react.gradle"` line.
1313
*
1414
* project.ext.react = [
1515
* // the name of the generated asset file containing your JS bundle
@@ -59,7 +59,7 @@ import com.android.build.OutputFile
5959
* ]
6060
*/
6161

62-
apply from: "../../node_modules/react-native/react.gradle"
62+
apply from: "react.gradle"
6363

6464
/**
6565
* Set this to true to create two separate APKs instead of one:
@@ -124,10 +124,3 @@ dependencies {
124124
compile "com.android.support:appcompat-v7:23.0.1"
125125
compile "com.facebook.react:react-native:+" // From node_modules
126126
}
127-
128-
// Run this once to be able to run the application with BUCK
129-
// puts all compile dependencies into folder libs for BUCK to use
130-
task copyDownloadableDepsToLibs(type: Copy) {
131-
from configurations.compile
132-
into 'libs'
133-
}

Example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"dependencies": {
99
"react": "^0.14.7",
10-
"react-native": "^0.24.0-rc5",
10+
"react-native": "^0.22.2",
1111
"react-native-button": "^1.2.1",
1212
"react-native-drawer": "^1.16.7",
1313
"react-native-modalbox": "^1.3.0",

src/DefaultRenderer.js

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,10 @@
99
import React, {Component, Animated, PropTypes, StyleSheet, View, NavigationExperimental} from "react-native";
1010
const {
1111
AnimatedView: NavigationAnimatedView,
12-
Card: NavigationCard
13-
} = NavigationExperimental;
14-
15-
const {
16-
CardStackPanResponder: NavigationCardStackPanResponder,
17-
CardStackStyleInterpolator: NavigationCardStackStyleInterpolator
18-
} = NavigationCard;
19-
12+
Card: NavigationCard,
13+
RootContainer: NavigationRootContainer,
14+
Header: NavigationHeader,
15+
} = NavigationExperimental;
2016
import TabBar from "./TabBar";
2117
import NavBar from "./NavBar";
2218
import Actions from './Actions';
@@ -63,13 +59,13 @@ export default class DefaultRenderer extends Component {
6359
return null;
6460
}
6561
let Component = navigationState.component;
66-
if (navigationState.tabs && !Component) {
62+
if (navigationState.tabs && !Component){
6763
Component = TabBar;
6864
}
6965
if (Component) {
7066
return (
7167
<View style={[{flex: 1}, navigationState.sceneStyle]}>
72-
<Component {...navigationState} navigationState={navigationState}/>
68+
<Component {...navigationState} navigationState={navigationState} />
7369
</View>
7470
)
7571
}
@@ -79,6 +75,7 @@ export default class DefaultRenderer extends Component {
7975

8076
let applyAnimation = selected.applyAnimation || navigationState.applyAnimation;
8177
let style = selected.style || navigationState.style;
78+
let direction = selected.direction || navigationState.direction || "horizontal";
8279

8380
let optionals = {};
8481
if (applyAnimation) {
@@ -88,11 +85,7 @@ export default class DefaultRenderer extends Component {
8885
if (duration === null || duration === undefined) duration = navigationState.duration;
8986
if (duration !== null && duration !== undefined) {
9087
optionals.applyAnimation = function (pos, navState) {
91-
if (duration === 0) {
92-
pos.setValue(navState.index);
93-
} else {
94-
Animated.timing(pos, {toValue: navState.index, duration}).start();
95-
}
88+
Animated.timing(pos, {toValue: navState.index, duration}).start();
9689
};
9790
}
9891
}
@@ -102,6 +95,7 @@ export default class DefaultRenderer extends Component {
10295
navigationState={navigationState}
10396
style={[styles.animatedView, style]}
10497
renderOverlay={this._renderHeader}
98+
direction={direction}
10599
renderScene={this._renderCard}
106100
{...optionals}
107101
/>
@@ -110,40 +104,25 @@ export default class DefaultRenderer extends Component {
110104

111105
_renderHeader(/*NavigationSceneRendererProps*/ props) {
112106
return <NavBar
113-
{...props}
114-
getTitle={state => state.title}
115-
/>;
107+
{...props}
108+
getTitle={state => state.title}
109+
/>;
116110
}
117111

118112
_renderCard(/*NavigationSceneRendererProps*/ props) {
119-
const {key, direction, getSceneStyle} = props.scene.navigationState;
120-
let {panHandlers, animationStyle} = props.scene.navigationState;
121-
122-
// Since we always need to pass a style for the direction, we can avoid #526
123-
let style = {};
124-
if (getSceneStyle) style = getSceneStyle(props);
113+
const { key, direction, panHandlers, getSceneStyle } = props.scene.navigationState;
125114

126-
const isVertical = direction === "vertical";
127-
128-
if (typeof(animationStyle) === 'undefined') {
129-
animationStyle = (isVertical ?
130-
NavigationCardStackStyleInterpolator.forVertical(props) :
131-
NavigationCardStackStyleInterpolator.forHorizontal(props));
132-
}
133-
134-
if (typeof(panHandlers) === 'undefined') {
135-
panHandlers = panHandlers || (isVertical ?
136-
NavigationCardStackPanResponder.forVertical(props) :
137-
NavigationCardStackPanResponder.forHorizontal(props));
138-
}
115+
const optionals = {};
116+
if (getSceneStyle) optionals.style = getSceneStyle(props);
139117

140118
return (
141119
<NavigationCard
142120
{...props}
143121
key={'card_' + key}
144-
style={[animationStyle, style]}
122+
direction={direction || 'horizontal'}
145123
panHandlers={panHandlers}
146124
renderScene={this._renderScene}
125+
{...optionals}
147126
/>
148127
);
149128
}
@@ -157,6 +136,6 @@ export default class DefaultRenderer extends Component {
157136
const styles = StyleSheet.create({
158137
animatedView: {
159138
flex: 1,
160-
backgroundColor: "transparent"
139+
backgroundColor:"transparent"
161140
},
162141
});

0 commit comments

Comments
 (0)