-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Touchable elements only work in the default page(first child) #62
Comments
We are experiencing the same issues with TouchableNativeFeedback on tabs other than the first tab. Would love to know if you figure it out. We're looking into it too. |
We are seeing that the hit areas stick for the first component. After you switch tabs, the first component's hit areas are still touchable. |
Correct !!. the only workaround.. hacky approach that I have found so far is.. to use onChangeTab.. and change the order of the children.. so the second becomes the first component.(assuming that only the first one works) but its a double transition. there should be a better solution. |
Might be related to facebook/react-native#3557 ? |
Im getting a blank page when using that new index.js.. after changing the style under <ScrollView from |
I've created a new version with ViewPagerAndroid: |
I'm using 0.13 and made a modified version of FacebookTabBar.js in the sample folder 'use strict';
var React = require('react-native');
var {
StyleSheet,
View,
TouchableWithoutFeedback,
Image
} = React;
var styles = StyleSheet.create({
tab: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
paddingBottom: 10,
},
tabs: {
height: 50,
flexDirection: 'row',
justifyContent: 'space-around',
paddingTop: 10,
borderWidth: 1,
borderTopWidth: 0,
borderLeftWidth: 0,
borderRightWidth: 0,
backgroundColor: '#1d1d1d',
borderBottomColor: 'rgba(0,0,0,0.05)',
},
unselect: {
width: 30, height: 30, tintColor: '#817061', borderWidth: 0.1
},
select: {
width: 30, height: 30, tintColor: '#ffb27a', borderWidth: 0.1
}
});
var FacebookTabBar = React.createClass({
propTypes: {
goToPage: React.PropTypes.func,
activeTab: React.PropTypes.number,
tabs: React.PropTypes.array
},
renderTabOption(name, page) {
var isTabActive = this.props.activeTab === page;
var useStyle
if(isTabActive){
useStyle = styles.select
} else {
useStyle = styles.unselect
}
return (
<TouchableWithoutFeedback key={name.uri} onPress={() => this.props.goToPage(page)} style={[styles.tab]}>
<View>
<Image
source={name}
style={useStyle}/>
</View>
</TouchableWithoutFeedback>
);
},
render() {
return (
<View style={styles.tabs}>
{this.props.tabs.map((tab, i) => this.renderTabOption(tab, i))}
</View>
);
},
});
module.exports = FacebookTabBar; To use this just require the module return (
<View style={styles.container}>
<ScrollableTabView renderTabBar={() => <FacebookTabBar />}>
<ScrollView tabLabel={require('image!ic_menu_main')} style={styles.tabView}>
// item 1
</ScrollView>
<ScrollView tabLabel={require('image!ic_menu_map')} style={styles.tabView}>
// item 2
</ScrollView>
<ScrollView tabLabel={require('image!ic_menu_cal')} style={styles.tabView}>
// item 3
</ScrollView>
<ScrollView tabLabel={require('image!ic_menu_fav')} style={styles.tabView}>
// item 4
</ScrollView>
<ScrollView tabLabel={require('image!ic_menu_user')} style={styles.tabView}>
// item 5
</ScrollView>
</ScrollableTabView>
</View>
); |
thanks all ... I took the 2 approaches, however, @gabecoyne ViewPagerAndroid worked great !! |
@gabecoyne +1, using ViewPagerAndroid makes this module obsolete, but nice experience getting the result we need. |
TextInput in the Search component does not work (second child)..It does not trigger any input or keyboard.. (ANDROID)
if I swap the children ..Search will work, but Home won't.
The first child component always work, so for this case the Home component works fine.
example :
Search - render
DOES ANYONE KNOW IF THERE IS SOMETHING MISSING HERE ?
The text was updated successfully, but these errors were encountered: