From 84ef7bc372ad870127b3e1fb8c13399fe09ecd4d Mon Sep 17 00:00:00 2001 From: Peter Argany Date: Tue, 27 Feb 2018 17:45:15 -0800 Subject: [PATCH] Added InputAccessoryView demo to RNTester [2/N] Summary: This is an example showing how to use an InputAccessoryView to build an iMessage-like sticky text input https://youtu.be/89PGsSqtmQU Reviewed By: sahrens Differential Revision: D7048456 fbshipit-source-id: 90314a85f3662c2b21aababe2dd46ea5e406604a --- RNTester/js/InputAccessoryViewExample.js | 101 +++++++++++++++++++++++ RNTester/js/RNTesterList.ios.js | 5 ++ 2 files changed, 106 insertions(+) create mode 100644 RNTester/js/InputAccessoryViewExample.js diff --git a/RNTester/js/InputAccessoryViewExample.js b/RNTester/js/InputAccessoryViewExample.js new file mode 100644 index 000000000..13b588578 --- /dev/null +++ b/RNTester/js/InputAccessoryViewExample.js @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @providesModule InputAccessoryViewExample + * @flow + * @format + */ + +'use strict'; + +const Alert = require('Alert'); +const Button = require('Button'); +const Dimensions = require('Dimensions'); +const InputAccessoryView = require('InputAccessoryView'); +const React = require('React'); +const ScrollView = require('ScrollView'); +const StyleSheet = require('StyleSheet'); +const Text = require('Text'); +const TextInput = require('TextInput'); +const View = require('View'); + +class Message extends React.PureComponent<*> { + render() { + return ( + + Text Message + + ); + } +} + +class TextInputBar extends React.PureComponent<*, *> { + state = {text: ''}; + + render() { + const {width} = Dimensions.get('window'); + return ( + + { + this.setState({text}); + }} + value={this.state.text} + placeholder={'Type a message...'} + /> +