Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Text Input inside Alert in React Native

Tags:

react-native

How to place multiple line text input inside Alert in react native Something like this..

This is the alert i want

like image 216
Vinay Hosamane Avatar asked Sep 12 '16 14:09

Vinay Hosamane


People also ask

Can we use text inside text in react-native?

In React Native, we are more strict about it: you must wrap all the text nodes inside of a <Text> component. You cannot have a text node directly under a <View> . You also lose the ability to set up a default font for an entire subtree.

Can't enter text in input field react-native?

To solve the issue of being unable to type in an input field in React, make sure to use the defaultValue prop instead of value for uncontrolled input fields. Alternatively, set an onChange prop on the field and handle the change event.


2 Answers

A custom component with Modal may help you achieve this.

like image 86
kitt Avatar answered Sep 22 '22 09:09

kitt


There is no way you could add a multiple line text input to the Alert component. According to the documentation (https://facebook.github.io/react-native/releases/0.29/docs/alert.html), it accepts a title, message, buttons and type only. You will need to create a custom component by yourself in order to achieve that.

like image 32
Mila Avatar answered Sep 22 '22 09:09

Mila