react-native - 如何处理 inputBox 以 scrollheight 的 keyboardAwareScrollView 为焦点
问题描述
我有一个带有下拉菜单的输入框。这里我使用了 KeyboardAwareScrollView。我为整个屏幕设置了 extraScrollHeight。
如果我专注于屏幕上的特定 inputBox,如何设置 extraScrollHeight 为 100。
请参阅我尝试过的代码
state = { isFocused: false }
handleInputFocus = () => this.setState({ isFocused: true })
<KeyboardAwareScrollView bounces = {false}
style = {{marginBottom:"7%"}}
scrollEnabled={true}
onFocus={this.handleInputFocus}
keyboardShouldPersistTaps={'always'} stickyHeaderIndices = {[0]}
extraScrollHeight = { isFocused ? 0 : 100 }
>
<TextInput underlineColorAndroid={'transparent'} style={{borderWidth: 1,
borderColor: '#d6d7da',
backgroundColor: '#ffffff'}} value={name} />
解决方案
推荐阅读
- dataset - 通过 WEKA 上的 URL 打开数据集
- python - 部署后将文件上传到文件夹烧瓶应用程序的问题
- docker - 使用 microsoft/aspnet docker 映像出现 Windows 容器错误的 Service Fabric
- python - 使用给定密码从加密的 rar 文件中提取内容
- dask - 具有异步实时并行性的 Dask 分布式
- java - 通过java socket使用HTTP协议上传文件
- redis - StackExchange Redis 故障转移损坏连接
- php - 无法按照我的意愿将数据写入 JSON
- go - 在 Kubernetes 上安装证书
- testing - 可以操纵 CasperJS 断言吗?