我正在尝试在 react native 中实现多行文本输入,但是当用户键入时,文本不会被换行,而是在同一行上水平书写,
我的文本输入的代码如下
<View style={[styles.container, props.containerStyles]}>
<TextInput
style={styles.placeholderStyle}
placeholder={"Placeholder text"}
value={this.state.reviewBody}
onChangeText={body => this.setState({ reviewBody: body })}
numberOfLines={5}
textAlignVertical={"top"}
textBreakStrategy={"highQuality"}
underlineColorAndroid={"transparent"}
autoCorrect
/>
</View>
Run Code Online (Sandbox Code Playgroud)
风格是,
const styles = StyleSheet.create({
container: {
flex: 1,
borderWidth: 2,
borderColor: "#f4f4f4",
width: WIDTH - 40,
maxWidth: WIDTH - 40,
minWidth: WIDTH - 40,
alignItems: "center",
justifyContent: "space-between",
paddingHorizontal: 5,
marginTop: 10,
flexWrap: "wrap",
},
placeholderStyle: {
fontSize: 11,
padding: 0,
flex: 1,
width: WIDTH - 40,
maxWidth: WIDTH - 40,
minWidth: WIDTH …Run Code Online (Sandbox Code Playgroud) 我遇到了有关mongodb中提供的mongodump函数的问题。当以下代码在mongodb shell上运行时,它不会响应,
Mongodump --db database1 --out path:
Run Code Online (Sandbox Code Playgroud) 我正在尝试构建一个用于存储和检索MCQ考试论文的API。我正在使用laravel资源类发送句柄Json数据。我需要在单个查询中将40条记录插入MySQL数据库,而无需使用多维数组。有没有可用的方法?
来自前端的样本数据:
{
"data":[
{
"paper_id":"5",
"question_no":"2",
"question":"test insert code",
"answer1":"answer1",
"answer2":"answer2 ",
"answer3":"answer3 ",
"answer4":"Answer4 ",
"answerC":"Correct Answer",
"knowarea":"who knows!"
},
{
"paper_id":"5",
"question_no":"3",
"question":"test insert code",
"answer1":"answer1",
"answer2":"answer2 ",
"answer3":"answer3 ",
"answer4":"Answer4 ",
"answerC":"Correct Answer",
"knowarea":"who knows!"
},
{
"paper_id":"5",
"question_no":"4",
"question":"test insert code",
"answer1":"answer1",
"answer2":"answer2 ",
"answer3":"answer3 ",
"answer4":"Answer4 ",
"answerC":"Correct Answer",
"knowarea":"who knows!"
},
{
"paper_id":"5",
"question_no":"5",
"question":"test insert code",
"aanswer1":"answer1",
"answer2":"answer2 ",
"answer3":"answer3 ",
"answer4":"Answer4 ",
"answerC":"Correct Answer",
"knowarea":"who knows!"
}
]
Run Code Online (Sandbox Code Playgroud)
}`
前端发送40个这样的对象,我需要将它们批量插入到我的数据库中。以下代码是我的控制器存储功能,
` …Run Code Online (Sandbox Code Playgroud) 我有一个 CSV 文件,其中数据为横向。ex:
name, test name
age, 20
gender,Male
Run Code Online (Sandbox Code Playgroud)
其中第一列是标题,第二列是数据,我尝试使用laravel maatwebsite/Excel和读取文件后的响应,第一行作为标题。(name和test name)。
有什么方法可以使用 maatwebsite/Excel 在 Laravel 中读取这种类型的 CSV 文件
我正在尝试使用 react-nativesecureTextEntry来隐藏我的密码并在注册期间确认密码字段。我使用自定义 InputBox 组件进行 textInput.below 是我的代码,
<InputBox
error={this.state.PwordError}
keyboardType={'default'}
onChangeText={Pword =>
this.setState({
Pword
})
}
secureTextEntry={true}
value={this.state.Pword}
pHolder={"Password"}
color={'white'} />
<View style={styles.spacer} />
<InputBox
error={this.state.CPwordError}
keyboardType={'default'}
onChangeText={CPword =>
this.setState({
CPword
})
}
secureTextEntry={true}
value={this.state.CPword}
pHolder={"Confirm Password"}
color={'white'} />
Run Code Online (Sandbox Code Playgroud)
当输入密码时,第一个文本框工作正常,它显示为点,但确认密码字段不起作用。有谁知道为什么会发生这种情况?
这是上面代码引用的输入框
<TextInput
underlineColorAndroid="transparent"
placeholder={this.props.pHolder}
placeholderTextColor={this.props.color === 'white' ? 'black':"white" }
{...this.props}
style={this.props.color == 'white' ? styles.ReginputStyle : styles.inputStyle}
/>
Run Code Online (Sandbox Code Playgroud)
我在用,
"react": "16.5.0",
"react-native": "0.57.1",
Run Code Online (Sandbox Code Playgroud)
我能够通过keyboardType={'default'}从我的输入组件中删除代码来解决这个问题。即使问题已解决,我也想知道为什么第一个secureTextEntry盒子可以工作而另一个却没有,因为它们除了值之外都是相同的。任何人都可以解释为什么会发生这种情况,
谢谢。