Modifying the value of a TextInput from its style (as we can do with the placeholder)












0















I'm new to React-Native



I use the tcomb-form-native module in order to create forms quickly :



const FormConnex = t.struct({
'email': t.String,
'password' : t.String,
});
...
render() {
return(
<KeyboardAwareScrollView style={styles.container} contentContainerStyle={styles.contentContainer}>
<Form ref={c => this._connex = c} type={FormConnex} options={optionsFormConnex} />{}
<Form ref={c => this._perso = c} type={FormPerso} options={optionsFormPerso} />{}
<Form ref={c => this._birthdate = c} type={FormBirthdate} options={optionsFormBirthdate} />{}
<Form ref={c => this._address = c} type={FormAddr} options={optionsFormAddr} />{}
<Form ref={c => this._role = c} type={FormRole} />{}
<Button title={'Créer un compte'} onPress={this.handleSubmit}/>
</KeyboardAwareScrollView>
);
}
...


And this is the way I set the properties of af field contained in a Form (for ex.optionsFormConnex) :



const optionsFormConnex = {
auto: 'placeholders',
label: 'Informations de connexion',
fields: {
email: {
keyboardType: 'email-address',
placeholder: 'E-mail',
},

password: {
password: true,
secureTextEntry: true,
placeholder: 'Mot de passe',
},
},
};


As you can see, it's easy to define the placeholder, but I don't know how to define the (default) value. I want all the fields to have a default value so I can test my fields faster.



The problem with this module, it's that it seems that I can't access the TextInput components, or I don't know how to do it.



With this module, how would you add a default value to a filed ?



**



EDIT :



**
I found the answer here : How to add a value to an inputText in tcomb-form-native?










share|improve this question

























  • According to the documentation you should be able to set a value property for each of the fields: github.com/gcanti/….

    – Phobos
    Nov 19 '18 at 19:48
















0















I'm new to React-Native



I use the tcomb-form-native module in order to create forms quickly :



const FormConnex = t.struct({
'email': t.String,
'password' : t.String,
});
...
render() {
return(
<KeyboardAwareScrollView style={styles.container} contentContainerStyle={styles.contentContainer}>
<Form ref={c => this._connex = c} type={FormConnex} options={optionsFormConnex} />{}
<Form ref={c => this._perso = c} type={FormPerso} options={optionsFormPerso} />{}
<Form ref={c => this._birthdate = c} type={FormBirthdate} options={optionsFormBirthdate} />{}
<Form ref={c => this._address = c} type={FormAddr} options={optionsFormAddr} />{}
<Form ref={c => this._role = c} type={FormRole} />{}
<Button title={'Créer un compte'} onPress={this.handleSubmit}/>
</KeyboardAwareScrollView>
);
}
...


And this is the way I set the properties of af field contained in a Form (for ex.optionsFormConnex) :



const optionsFormConnex = {
auto: 'placeholders',
label: 'Informations de connexion',
fields: {
email: {
keyboardType: 'email-address',
placeholder: 'E-mail',
},

password: {
password: true,
secureTextEntry: true,
placeholder: 'Mot de passe',
},
},
};


As you can see, it's easy to define the placeholder, but I don't know how to define the (default) value. I want all the fields to have a default value so I can test my fields faster.



The problem with this module, it's that it seems that I can't access the TextInput components, or I don't know how to do it.



With this module, how would you add a default value to a filed ?



**



EDIT :



**
I found the answer here : How to add a value to an inputText in tcomb-form-native?










share|improve this question

























  • According to the documentation you should be able to set a value property for each of the fields: github.com/gcanti/….

    – Phobos
    Nov 19 '18 at 19:48














0












0








0








I'm new to React-Native



I use the tcomb-form-native module in order to create forms quickly :



const FormConnex = t.struct({
'email': t.String,
'password' : t.String,
});
...
render() {
return(
<KeyboardAwareScrollView style={styles.container} contentContainerStyle={styles.contentContainer}>
<Form ref={c => this._connex = c} type={FormConnex} options={optionsFormConnex} />{}
<Form ref={c => this._perso = c} type={FormPerso} options={optionsFormPerso} />{}
<Form ref={c => this._birthdate = c} type={FormBirthdate} options={optionsFormBirthdate} />{}
<Form ref={c => this._address = c} type={FormAddr} options={optionsFormAddr} />{}
<Form ref={c => this._role = c} type={FormRole} />{}
<Button title={'Créer un compte'} onPress={this.handleSubmit}/>
</KeyboardAwareScrollView>
);
}
...


And this is the way I set the properties of af field contained in a Form (for ex.optionsFormConnex) :



const optionsFormConnex = {
auto: 'placeholders',
label: 'Informations de connexion',
fields: {
email: {
keyboardType: 'email-address',
placeholder: 'E-mail',
},

password: {
password: true,
secureTextEntry: true,
placeholder: 'Mot de passe',
},
},
};


As you can see, it's easy to define the placeholder, but I don't know how to define the (default) value. I want all the fields to have a default value so I can test my fields faster.



The problem with this module, it's that it seems that I can't access the TextInput components, or I don't know how to do it.



With this module, how would you add a default value to a filed ?



**



EDIT :



**
I found the answer here : How to add a value to an inputText in tcomb-form-native?










share|improve this question
















I'm new to React-Native



I use the tcomb-form-native module in order to create forms quickly :



const FormConnex = t.struct({
'email': t.String,
'password' : t.String,
});
...
render() {
return(
<KeyboardAwareScrollView style={styles.container} contentContainerStyle={styles.contentContainer}>
<Form ref={c => this._connex = c} type={FormConnex} options={optionsFormConnex} />{}
<Form ref={c => this._perso = c} type={FormPerso} options={optionsFormPerso} />{}
<Form ref={c => this._birthdate = c} type={FormBirthdate} options={optionsFormBirthdate} />{}
<Form ref={c => this._address = c} type={FormAddr} options={optionsFormAddr} />{}
<Form ref={c => this._role = c} type={FormRole} />{}
<Button title={'Créer un compte'} onPress={this.handleSubmit}/>
</KeyboardAwareScrollView>
);
}
...


And this is the way I set the properties of af field contained in a Form (for ex.optionsFormConnex) :



const optionsFormConnex = {
auto: 'placeholders',
label: 'Informations de connexion',
fields: {
email: {
keyboardType: 'email-address',
placeholder: 'E-mail',
},

password: {
password: true,
secureTextEntry: true,
placeholder: 'Mot de passe',
},
},
};


As you can see, it's easy to define the placeholder, but I don't know how to define the (default) value. I want all the fields to have a default value so I can test my fields faster.



The problem with this module, it's that it seems that I can't access the TextInput components, or I don't know how to do it.



With this module, how would you add a default value to a filed ?



**



EDIT :



**
I found the answer here : How to add a value to an inputText in tcomb-form-native?







react-native tcomb-form-native






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 19 '18 at 22:48







davalres

















asked Nov 19 '18 at 19:08









davalresdavalres

43




43













  • According to the documentation you should be able to set a value property for each of the fields: github.com/gcanti/….

    – Phobos
    Nov 19 '18 at 19:48



















  • According to the documentation you should be able to set a value property for each of the fields: github.com/gcanti/….

    – Phobos
    Nov 19 '18 at 19:48

















According to the documentation you should be able to set a value property for each of the fields: github.com/gcanti/….

– Phobos
Nov 19 '18 at 19:48





According to the documentation you should be able to set a value property for each of the fields: github.com/gcanti/….

– Phobos
Nov 19 '18 at 19:48












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381107%2fmodifying-the-value-of-a-textinput-from-its-style-as-we-can-do-with-the-placeho%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53381107%2fmodifying-the-value-of-a-textinput-from-its-style-as-we-can-do-with-the-placeho%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()