2015-12-04 1 views
1

J'essaye de créer 3 TextInputs dans une rangée, mais quand j'écris flexDirection: 'row' cela ne fonctionne pas (je ne vois aucune entrée de texte sur l'appareil).Comment créer des entrées de texte sur une ligne? (React Native)

var SampleApp = React.createClass({ 
render: function() { 
return (
    <View style={styles.container}> 
    <View style={styles.textInputWrapper}> 
     <TextInput style={styles.textInput} 
     placeholder='Month' 
     placeholderTextColor="#d3d3d3" 
     /> 
    </View> 
    <View style={styles.textInputWrapper}> 
     <TextInput style={styles.textInput} 
     placeholder='Day' 
     placeholderTextColor="#d3d3d3" 
     /> 
    </View> 
    <View style={styles.textInputWrapper}> 
     <TextInput style={styles.textInput} 
     placeholder='Year' 
     placeholderTextColor="#d3d3d3" 
     /> 
    </View> 
    </View> 
); 
    } 
}); 

var styles = StyleSheet.create({ 
container: { 
flex: 1, 
flexDirection: 'row' 
} 
}); 
+0

Veuillez inclure le code approprié ici, au lieu d'afficher un lien. – Skynet

+0

déjà fait – Maksim

Répondre

2

Vous devez ajouter des styles pour chaque composant. J'espère que cette aide.

var styles = StyleSheet.create({ 
container: { 
    flex: 1, 
    flexDirection: 'row' 
}, 
textInputWrapper: { 
    flex:1, 
    height: 50, 
    borderColor:'red', 
    borderWidth: 2, 
}, 
textInput:{ 
    flex:1, 
} 

});