gcanti / tcomb-form

Forms library for react
https://gcanti.github.io/tcomb-form
MIT License
1.16k stars 136 forks source link

Create large text field to enter 300 chars or more. #393

Closed Herxheimer closed 6 years ago

Herxheimer commented 6 years ago

I'm trying to create a customer support form that lets a user describe the issues they are having. I'm not sure how to create a large text field in tcomb

example-large-text-field

gcanti commented 6 years ago

type attribute = textarea, see https://github.com/gcanti/tcomb-form/blob/master/GUIDE.md#textbox-options

Herxheimer commented 6 years ago

I tried setting the type attribute but nothing happened

Code:

const tcombForm = t.struct({
  test: t.String
    });

const options = {
 fields: {
   test: {
     type: 'textarea'
    },
  }
}; 
gcanti commented 6 years ago

Just tried with

const tcombForm = t.struct({
  test: t.String
})

const options = {
  fields: {
    test: {
      type: 'textarea',
      attrs: {
        rows: 20
      }
    }
  }
}

and works fine

Herxheimer commented 6 years ago

Thanks, but I tried your code in Atom and in a tcomb virtual playground here https://gcanti.github.io/resources/tcomb-form/playground/playground.html ...yet it still didn't work.

Do you have a link to a working example that I could look at?

gcanti commented 6 years ago

Beware the playground is outdated

Herxheimer commented 6 years ago

O ok that makes sense, I still tried the code in a hot loaded RN project but it didn't work. Is there a code example I could look at?

gcanti commented 6 years ago

Wait, RN means React Native? Not sure if tcomb-form is able to run there..

Herxheimer commented 6 years ago

Yes React Native, I've been using tcomb forms for my project and so far everything else has worked (forms, validation, styling) except for the text area

gcanti commented 6 years ago

I'm not by any means a mobile developer so maybe in the meanwhile something has changed, but I thought you have to use tcomb-form-native with RN

Herxheimer commented 6 years ago

O no you're correct, I guess I posted this in the wrong thread.

Thanks!