Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native: How to inline a textInput with a button?

I am creating a chatbot ui in ReactNative How can I implement an inline textinput with button ?

<View>
 <Textinput />
 <Button>Press</Button>
</View>
like image 795
power-cut Avatar asked Feb 11 '18 17:02

power-cut


People also ask

How do I add a button in TextInput react-native?

import Button from '../components/Button'; I like to keep the button in an external folder, where it is like: import React, { Component } from 'react'; import { Text, TouchableOpacity } from 'react-native'; class Button extends Component { handlePress(e) { if (this. props.

How do you focus TextInput in react-native?

Two methods exposed via the native element are .focus() and .blur() that will focus or blur the TextInput programmatically.

How do I create a TextInput component in react-native?

For creating a TextInput in react native we have to import the TextInput component from React Native. Props for TextInput Component: allowFontScaling: This property will specify if the fonts will scale to respect Text Size accessibility settings. The default value for this is true.


1 Answers

To organize components horizontally you need to use flexDirection. Default flexDirection is set to column.

<View style={{ flexDirection:'row' }}>
  <Textinput />
  <Button>Press</Button>
</View>
like image 133
Pir Shukarullah Shah Avatar answered Sep 21 '22 11:09

Pir Shukarullah Shah