react-native: [Android] ViewPagerAndroid - initialPage not working
Hello,
it seems like “initialPage” is not working at all with current master. I’m afraid I can not provide a RNPlay example, as the entire ViewPagerAndroid is not working with the RN versions provided by RNPlay (@jsierles As discussed in Discord yesterday).
However, here is the coding - basically taken from the example section of ViewPagerAndroid.
/**
* Sample React Native App
* https://github.com/facebook/react-native
*/
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
View,
ViewPagerAndroid,
} = React;
var AwesomeProject = React.createClass({
render: function() {
return (
<ViewPagerAndroid
style={{flex: 1}}
initialPage={1}>
<View style={styles.pageStyle}>
<Text>First page</Text>
</View>
<View style={styles.pageStyle}>
<Text>Second page</Text>
</View>
</ViewPagerAndroid>
);
}
});
var styles = StyleSheet.create({
pageStyle: {
alignItems: 'center',
padding: 20,
}
});
AppRegistry.registerComponent('AwesomeProject', () => AwesomeProject);
@mkonicek: Do you have an idea here? It seems that you have open sourced this component 😃
Thanks a lot! Philipp
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 17 (17 by maintainers)
I’ve made the following changes to ReactViewPager.java and my tests have all passed - do you have any comments? Else I’d prepare a PR: