-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
I made a demo https://rnplay.org/plays/iBVgwg
so the problem is that third button isn't working. The only difference between buttons is the way I passed them in Header
component.
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
View,
TouchableWithoutFeedback,
Text
} = React;
var ThirdButton = React.createClass({
render() {
return (
<View style={styles.button}>
<Text>Third Button</Text>
</View>
);
}
});
var Header = React.createClass({
propTypes: {
secondButton: React.PropTypes.object,
thirdButton: React.PropTypes.object,
onPress: React.PropTypes.func,
},
_handlePress(data) {
this.props.onPress(data);
},
/*========== render ==========*/
render() {
return (
<View style={styles.container}>
<TouchableWithoutFeedback onPress={this._handlePress.bind(this, "First")}>
<View style={styles.button}>
<Text>Fitst Button</Text>
</View>
</TouchableWithoutFeedback>
<TouchableWithoutFeedback onPress={this._handlePress.bind(this, "Second")}>
{this.props.secondButton}
</TouchableWithoutFeedback>
<TouchableWithoutFeedback onPress={this._handlePress.bind(this, "Third")}>
{this.props.thirdButton}
</TouchableWithoutFeedback>
</View>
);
}
});
var SampleApp = React.createClass({
getInitialState(){
return {
text: "Tap on the button"
};
},
_handlePress(msg) {
this.setState({
text: msg
});
},
render() {
return (
<View>
<Header secondButton={<View style={styles.button}><Text>Second Button</Text></View>}
thirdButton={<ThirdButton />}
onPress={this._handlePress} />
<Text>{this.state.text}</Text>
</View>
);
}
});
var styles = StyleSheet.create({
container: {
backgroundColor: "#eee",
height:60,
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
},
button: {
backgroundColor: "#FF0",
}
});
// AppRegistry.registerComponent('SpeedPocket', () => SampleApp);
module.exports = SampleApp;
React.AppRegistry.registerComponent("SpeedPocket", () => SampleApp);
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.