Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/386.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript react native,如何将剪贴板中的文本粘贴到文本输入中_Javascript_React Native - Fatal编程技术网

Javascript react native,如何将剪贴板中的文本粘贴到文本输入中

Javascript react native,如何将剪贴板中的文本粘贴到文本输入中,javascript,react-native,Javascript,React Native,目前我使用的是native base,搜索栏有这种类型的文本输入 <Text> Card Name </Text> <Header searchBar rounded style={{ backgroundColor: '#E9E9EF'}}> <Item style={{ backgroundColor: 'lightgray', borderRadius: 5 }}> <Icon name="ios-search

目前我使用的是native base,搜索栏有这种类型的文本输入

<Text>
   Card Name
</Text>
<Header searchBar rounded style={{ backgroundColor: '#E9E9EF'}}> 
   <Item style={{ backgroundColor: 'lightgray', borderRadius: 5 }}>
      <Icon name="ios-search" />
      <Input placeholder="Search" onChangeText={(searchText) => this.setState({searchText})} value={this.state.searchText} />
   </Item>
</Header>

我想启用从剪贴板粘贴,用户可以从其他地方复制一些文本并粘贴到这个搜索输入框中。我如何才能做到这一点?

您可以使用剪贴板API: 或Textinput属性:选择TextOnFocus

<TextInput selectTextOnFocus={true} />

您可以使用剪贴板API: 或Textinput属性:选择TextOnFocus

<TextInput selectTextOnFocus={true} />
如果复制/粘贴不适用于react native中的TextInput。您可以按照此代码进行操作

如果复制/粘贴不适用于react native中的TextInput。您可以按照此代码进行操作


在这个Git回复中找到的解决方案对我来说效果更好:


在这个Git回复中找到的解决方案对我来说效果更好:


用户RN手势处理程序的TextInput而不是react native的 从“反应本机手势处理程序”导入{TextInput}

请添加以下内容 选择textonfocus={true}
到TexInput

用户RN手势处理程序的文本输入,而不是react native的文本输入 从“反应本机手势处理程序”导入{TextInput}

请添加以下内容 选择textonfocus={true}
对于TexInput

这是TextInput secureTextEntry={true}works中的参数

这是TextInput secureTextEntry={true}works中的参数

布尔jsx道具很好像这样SelectTextOnFocus布尔jsx道具很好像这样SelectTextOnFocus我在这篇文章中回答了这个问题,请找到我希望它会有所帮助。我在这篇文章中回答了这个问题,我希望它能有所帮助。我在这篇文章中回答了这个问题,我希望它能有所帮助。我在这篇文章中回答,请找到我希望它会有所帮助。我在这篇文章中回答了这个问题,我希望它能有所帮助。我在这篇文章中回答了这个问题,我希望它能有所帮助。secureTextEntry屏蔽输入。这不是ops问题的答案SecureTextEntry屏蔽了输入。这不是问题的答案
 <ScrollView
contentContainerStyle={Styles.contentContainerStyle}
keyboardShouldPersistTaps="handled"
removeClippedSubviews={false}>

 <KeyboardAvoidingView>

      <Text style={Styles.labelPageTitle}>
        {'bla bla bla'}
      </Text>
      <Text>
          {'bla bla bla'}
      </Text>
      <TextInput
        onChangeText={text => this.setState({ title: text })}
        style={Styles.textInput}
        value={title}
      />

</KeyboardAvoidingView>