Skipping Views in React Native render function

user6282639

I'm trying to render a view with with two TextInput components. This is my render function:

 render () {
   return (
  <View style={styles.container}>

     <TextInput ref='title'
                placeholder="Untitled"
                style={styles.textInput, styles.title}
                autoFocus={true}
                onSubmitEditing={(event) => {this.refs.body.focus()}}
                />



     <TextInput ref='body'
         autoFocus={true}
         multiline={true}
         placeholder="Start typing"
         style={styles.textInput, styles.body}
         />

  </View>
);

Now, I would like to add an underline under each TextInput. In order to do that, I'm wrapping each TextInputs in a View component and adding a borderBottom to the style of the View in this way:

render () {
   return (
  <View style={styles.container}>
    <View style={styles.inputContainer}>
     <TextInput ref='title'
                placeholder="Untitled"
                style={styles.textInput, styles.title}
                autoFocus={true}
                onSubmitEditing={(event) => {this.refs.body.focus()}}
                />
    </View>

    <View style={styles.inputContainer}>
     <TextInput ref='body'
         autoFocus={true}
         multiline={true}
         placeholder="Start typing"
         style={styles.textInput, styles.body}
         />
    </View>
  </View>
);

These are all my styles:

var styles = StyleSheet.create({
 container: {
   flex: 1,
   justifyContent: 'center',
   alignItems: 'center',
   marginTop: 64
 },
  title: {
    height: 40
  },
  body: {
    flex: 1
  },

 inputContainer: {
   borderBottomColor: '#9E7CE3',
   borderBottomWidth: 1,
   flexDirection: 'row',
   marginBottom: 10
 },

 textInput: { 
   flex: 1,
   fontSize: 16,
 },

});

However the two TextInputs disappear and I cannot understand why (Note: using ES6)

Jickson

Comment the line flexDirection: 'row', then TextInputs will appear.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

React Native render function throws error

From Dev

React Native call a function in a render method

From Dev

How to render components using function in React Native

From Dev

React Native and Flexbox Views

From Dev

React Native render function gives an error : Unexpected token

From Dev

Render Content Dynamically from an array map function in React Native

From Dev

How do I render a function which contain a view in react native?

From Dev

React Native FlatList - Calling A Function In The Render Method Which Returns A Component

From Dev

Render HTML in React Native

From Dev

React Native staggered render

From Dev

React Native View Render

From Dev

React Native: Render on Fetch

From Dev

Using native ios views in React Native

From Dev

How to use native views in React native app

From Dev

Using native ios views in React Native

From Dev

how to render objects in react native?

From Dev

react native render only part

From Dev

setState not causing a render React Native

From Dev

React Native : FlatList does not render

From Dev

React Native / React - refactoring prop before render()

From Dev

react native : How to fix the error - Passing an inline function will cause the component state to be lost on re-render?

From Dev

react native : How to fix the error - Passing an inline function will cause the component state to be lost on re-render?

From Dev

Example of Navigation between views in React Native Android?

From Java

React onClick function fires on render

From Java

Dynamically building a render function in React

From Java

React Context: TypeError: render is not a function

From Dev

React-router : render is not a function

From Dev

React error: TypeError: render is not a function

From Dev

Render object arrays in react function

Related Related

  1. 1

    React Native render function throws error

  2. 2

    React Native call a function in a render method

  3. 3

    How to render components using function in React Native

  4. 4

    React Native and Flexbox Views

  5. 5

    React Native render function gives an error : Unexpected token

  6. 6

    Render Content Dynamically from an array map function in React Native

  7. 7

    How do I render a function which contain a view in react native?

  8. 8

    React Native FlatList - Calling A Function In The Render Method Which Returns A Component

  9. 9

    Render HTML in React Native

  10. 10

    React Native staggered render

  11. 11

    React Native View Render

  12. 12

    React Native: Render on Fetch

  13. 13

    Using native ios views in React Native

  14. 14

    How to use native views in React native app

  15. 15

    Using native ios views in React Native

  16. 16

    how to render objects in react native?

  17. 17

    react native render only part

  18. 18

    setState not causing a render React Native

  19. 19

    React Native : FlatList does not render

  20. 20

    React Native / React - refactoring prop before render()

  21. 21

    react native : How to fix the error - Passing an inline function will cause the component state to be lost on re-render?

  22. 22

    react native : How to fix the error - Passing an inline function will cause the component state to be lost on re-render?

  23. 23

    Example of Navigation between views in React Native Android?

  24. 24

    React onClick function fires on render

  25. 25

    Dynamically building a render function in React

  26. 26

    React Context: TypeError: render is not a function

  27. 27

    React-router : render is not a function

  28. 28

    React error: TypeError: render is not a function

  29. 29

    Render object arrays in react function

HotTag

Archive