Skip to content

Commit c7ff973

Browse files
committed
1.升级demo依赖框架
2.添加selectedItemStyle
1 parent 6b65463 commit c7ff973

File tree

9 files changed

+1079
-236
lines changed

9 files changed

+1079
-236
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,5 @@ local.properties
3333
node_modules/
3434
npm-debug.log
3535

36-
rn-viewpager-*
36+
rn-viewpager-*
37+
.tmp

RNViewPagerDemo/app/components/common/navigator/XNavigator.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
'use strict'
66

7-
import { StyleSheet, Navigator, Platform, View, Text, Image, BackAndroid } from 'react-native'
7+
import { StyleSheet, Platform, View, Text, Image, BackAndroid } from 'react-native'
8+
import { Navigator } from 'react-native-deprecated-custom-components'
89
import { PropTypes } from 'react'
910
import React from 'react'
1011
import XNavBarStyle from './XNavBarStyle'
@@ -51,7 +52,7 @@ export default class XNavigator extends React.Component {
5152
{...this.props}
5253
ref={this._setNavigatorRef}
5354
style={[XNavigatorStyles.navigator, this.props.style]}
54-
sceneStyle={[XNavigatorStyles.scene, {paddingTop: sencePaddingTop}, this.props.sceneStyle]}
55+
sceneStyle={StyleSheet.flatten([XNavigatorStyles.scene, {paddingTop: sencePaddingTop}, this.props.sceneStyle])}
5556
navigationBar={this._renderNavigationBar()}
5657
configureScene={route => this._routeRenderer.configureScene(route)}
5758
renderScene={this._renderScene}

RNViewPagerDemo/app/components/common/navigator/XRouteRenderer.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {
77
StyleSheet,
88
Text,
99
TouchableOpacity,
10-
View,
11-
Navigator
10+
View
1211
} from 'react-native'
12+
import { Navigator } from 'react-native-deprecated-custom-components'
1313
import XNavigatorStyles from './XNavigatorStyles'
1414
import { BackIcon } from './XNavigatorIcons'
1515

@@ -28,8 +28,8 @@ class NavigationBarRouteMapper {
2828
<View style={XNavigatorStyles.barTitle} >
2929
<Text style={[XNavigatorStyles.barTitleText, this._titleStyle]} allowFontScaling={false} >
3030
{shortenTitle(route.getTitle(this._navigator, index, state))}
31-
</Text>
32-
</View>
31+
</Text >
32+
</View >
3333
)
3434
}
3535

@@ -60,7 +60,7 @@ class NavigationBarRouteMapper {
6060
allowFontScaling={false}
6161
>
6262
{title}
63-
</Text>
63+
</Text >
6464
)
6565
}
6666
return (
@@ -71,7 +71,7 @@ class NavigationBarRouteMapper {
7171
>
7272
<BackIcon style={[XNavigatorStyles.barButtonIcon, this._barButtonIconStyle]} />
7373
{buttonText}
74-
</TouchableOpacity>
74+
</TouchableOpacity >
7575
)
7676
}
7777

@@ -93,7 +93,7 @@ class NavigationBarRouteMapper {
9393
allowFontScaling={false}
9494
>
9595
{title}
96-
</Text>
96+
</Text >
9797
)
9898
if (imgSource)
9999
buttonImage = (
@@ -111,7 +111,7 @@ class NavigationBarRouteMapper {
111111
>
112112
{buttonImage}
113113
{buttonText}
114-
</TouchableOpacity>
114+
</TouchableOpacity >
115115
)
116116
}
117117
}
@@ -186,9 +186,9 @@ export default class ExRouteRenderer {
186186
}
187187

188188
onBackPress () {
189-
if (!this._navigator)return
189+
if (!this._navigator) return
190190
let currentRoutes = this._navigator.getCurrentRoutes()
191-
if (!currentRoutes && currentRoutes.length == 0)return
191+
if (!currentRoutes && currentRoutes.length == 0) return
192192
let currentRoute = currentRoutes[currentRoutes.length - 1]
193193

194194
if (currentRoute.onBackPress) return currentRoute.onBackPress(this._navigator)
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
* Created by tangzhibin on 16/7/19.
3+
*/
4+
5+
'use strict'
6+
import React, { Component } from 'react'
7+
import { StyleSheet, View, Text, TouchableOpacity, Image, ListView } from 'react-native'
8+
import { IndicatorViewPager, PagerDotIndicator } from 'rn-viewpager'
9+
10+
export default class DotIndicatorInListPage extends Component {
11+
constructor (props) {
12+
super(props)
13+
this._renderHeader = this._renderHeader.bind(this)
14+
var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2})
15+
this.state = {dataSource: ds.cloneWithRows(['row 1', 'row 2', 'row 2', 'row 3', 'row 4'])}
16+
}
17+
18+
render () {
19+
return (
20+
<ListView
21+
style={{flex: 1}}
22+
dataSource={this.state.dataSource}
23+
renderRow={(rowData) => <Text>{rowData}</Text>}
24+
renderHeader={this._renderHeader}
25+
/>
26+
)
27+
}
28+
29+
_renderHeader () {
30+
return (
31+
<IndicatorViewPager
32+
style={{height: 200}}
33+
indicator={this._renderIndicator()}
34+
autoPlayEnable
35+
onPageSelected={(p) => console.log(p)}
36+
>
37+
<View style={{backgroundColor: 'red'}} />
38+
<View style={{backgroundColor: 'green'}} />
39+
<View style={{backgroundColor: 'yellow'}} />
40+
</IndicatorViewPager>
41+
)
42+
}
43+
44+
_renderIndicator () {
45+
return (
46+
<PagerDotIndicator
47+
pageCount={3}
48+
style={{bottom: 16}}
49+
dotStyle={{backgroundColor: '#FFFFFF88'}}
50+
/>
51+
)
52+
}
53+
54+
}
55+
56+
const styles = StyleSheet.create({
57+
bannerImg: {
58+
flex: 1,
59+
height: 100,
60+
width: 300
61+
}
62+
})

RNViewPagerDemo/ios/RNViewPagerDemo.xcodeproj/project.pbxproj

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
2626
2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
2727
2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
28-
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */; };
28+
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
2929
2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */; };
3030
2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */; };
3131
2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */; };
@@ -102,6 +102,34 @@
102102
remoteGlobalIDString = 83CBBA2E1A601D0E00E9B192;
103103
remoteInfo = React;
104104
};
105+
181B21C21F7A1E2C002F02AC /* PBXContainerItemProxy */ = {
106+
isa = PBXContainerItemProxy;
107+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
108+
proxyType = 2;
109+
remoteGlobalIDString = 139D7ECE1E25DB7D00323FB7;
110+
remoteInfo = "third-party";
111+
};
112+
181B21C41F7A1E2C002F02AC /* PBXContainerItemProxy */ = {
113+
isa = PBXContainerItemProxy;
114+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
115+
proxyType = 2;
116+
remoteGlobalIDString = 3D383D3C1EBD27B6005632C8;
117+
remoteInfo = "third-party-tvOS";
118+
};
119+
181B21C61F7A1E2C002F02AC /* PBXContainerItemProxy */ = {
120+
isa = PBXContainerItemProxy;
121+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
122+
proxyType = 2;
123+
remoteGlobalIDString = 139D7E881E25C6D100323FB7;
124+
remoteInfo = "double-conversion";
125+
};
126+
181B21C81F7A1E2C002F02AC /* PBXContainerItemProxy */ = {
127+
isa = PBXContainerItemProxy;
128+
containerPortal = 146833FF1AC3E56700842450 /* React.xcodeproj */;
129+
proxyType = 2;
130+
remoteGlobalIDString = 3D383D621EBD27B9005632C8;
131+
remoteInfo = "double-conversion-tvOS";
132+
};
105133
2D02E4911E0B4A5D006451C7 /* PBXContainerItemProxy */ = {
106134
isa = PBXContainerItemProxy;
107135
containerPortal = 83CBB9F71A601CBA00E9B192 /* Project object */;
@@ -289,7 +317,7 @@
289317
buildActionMask = 2147483647;
290318
files = (
291319
2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */,
292-
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation-tvOS.a in Frameworks */,
320+
2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */,
293321
2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */,
294322
2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */,
295323
2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */,
@@ -411,6 +439,10 @@
411439
3DAD3EAB1DF850E9000B6D8A /* libcxxreact.a */,
412440
3DAD3EAD1DF850E9000B6D8A /* libjschelpers.a */,
413441
3DAD3EAF1DF850E9000B6D8A /* libjschelpers.a */,
442+
181B21C31F7A1E2C002F02AC /* libthird-party.a */,
443+
181B21C51F7A1E2C002F02AC /* libthird-party.a */,
444+
181B21C71F7A1E2C002F02AC /* libdouble-conversion.a */,
445+
181B21C91F7A1E2C002F02AC /* libdouble-conversion.a */,
414446
);
415447
name = Products;
416448
sourceTree = "<group>";
@@ -419,7 +451,7 @@
419451
isa = PBXGroup;
420452
children = (
421453
5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */,
422-
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */,
454+
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */,
423455
);
424456
name = Products;
425457
sourceTree = "<group>";
@@ -706,6 +738,34 @@
706738
remoteRef = 146834031AC3E56700842450 /* PBXContainerItemProxy */;
707739
sourceTree = BUILT_PRODUCTS_DIR;
708740
};
741+
181B21C31F7A1E2C002F02AC /* libthird-party.a */ = {
742+
isa = PBXReferenceProxy;
743+
fileType = archive.ar;
744+
path = "libthird-party.a";
745+
remoteRef = 181B21C21F7A1E2C002F02AC /* PBXContainerItemProxy */;
746+
sourceTree = BUILT_PRODUCTS_DIR;
747+
};
748+
181B21C51F7A1E2C002F02AC /* libthird-party.a */ = {
749+
isa = PBXReferenceProxy;
750+
fileType = archive.ar;
751+
path = "libthird-party.a";
752+
remoteRef = 181B21C41F7A1E2C002F02AC /* PBXContainerItemProxy */;
753+
sourceTree = BUILT_PRODUCTS_DIR;
754+
};
755+
181B21C71F7A1E2C002F02AC /* libdouble-conversion.a */ = {
756+
isa = PBXReferenceProxy;
757+
fileType = archive.ar;
758+
path = "libdouble-conversion.a";
759+
remoteRef = 181B21C61F7A1E2C002F02AC /* PBXContainerItemProxy */;
760+
sourceTree = BUILT_PRODUCTS_DIR;
761+
};
762+
181B21C91F7A1E2C002F02AC /* libdouble-conversion.a */ = {
763+
isa = PBXReferenceProxy;
764+
fileType = archive.ar;
765+
path = "libdouble-conversion.a";
766+
remoteRef = 181B21C81F7A1E2C002F02AC /* PBXContainerItemProxy */;
767+
sourceTree = BUILT_PRODUCTS_DIR;
768+
};
709769
3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */ = {
710770
isa = PBXReferenceProxy;
711771
fileType = archive.ar;
@@ -804,10 +864,10 @@
804864
remoteRef = 5E9157321DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
805865
sourceTree = BUILT_PRODUCTS_DIR;
806866
};
807-
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation-tvOS.a */ = {
867+
5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */ = {
808868
isa = PBXReferenceProxy;
809869
fileType = archive.ar;
810-
path = "libRCTAnimation-tvOS.a";
870+
path = libRCTAnimation.a;
811871
remoteRef = 5E9157341DD0AC6500FF2AA8 /* PBXContainerItemProxy */;
812872
sourceTree = BUILT_PRODUCTS_DIR;
813873
};
@@ -874,7 +934,7 @@
874934
);
875935
runOnlyForDeploymentPostprocessing = 0;
876936
shellPath = /bin/sh;
877-
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/packager/react-native-xcode.sh";
937+
shellScript = "export NODE_BINARY=node\n../node_modules/react-native/scripts/react-native-xcode.sh";
878938
};
879939
2D02E4CB1E0B4B27006451C7 /* Bundle React Native Code And Images */ = {
880940
isa = PBXShellScriptBuildPhase;

RNViewPagerDemo/package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
"test": "jest"
88
},
99
"dependencies": {
10-
"react": "~15.4.1",
11-
"react-native": "0.42.3",
12-
"rn-viewpager": "^1.2.2"
10+
"react": "16.0.0-alpha.12",
11+
"react-native": "^0.48.4",
12+
"react-native-deprecated-custom-components": "^0.1.1",
13+
"rn-viewpager": "^1.2.4"
1314
},
1415
"devDependencies": {
1516
"babel-jest": "19.0.0",

0 commit comments

Comments
 (0)