如何从 MKTextField 获取文本
how to get text from MKTextField
您好,我在 React 本机应用程序中使用浮动标签 (MKTextField)。我想知道如何从中获取文本。我试着在网上看,但没找到。
使用 React Native material 套件 "react-native-material-kit": "^0.5.1",
你能推荐一下吗
谢谢
R
<TextfieldWithFloatingLabel_Card ref="tiNumber"/>
const TextfieldWithFloatingLabel_Card = MKTextField.textfieldWithFloatingLabel()
.withPlaceholder('Last 4 digits of your dopay card')
.withStyle(styles.textfieldWithFloatingLabel)
.withTextInputStyle({flex: 1})
.withFloatingLabelFont({
fontSize: 12,
fontWeight: '200',
color: colors.primaryColor
})
.withKeyboardType('numeric')
.build();
获取文本有多个道具。考虑下面的代码
<TextfieldWithFloatingLabel_Card ref="tiNumber"/>
const TextfieldWithFloatingLabel_Card = MKTextField.textfieldWithFloatingLabel()
.withPlaceholder('Last 4 digits of your dopay card')
.withStyle(styles.textfieldWithFloatingLabel)
.withTextInputStyle({flex: 1})
.withFloatingLabelFont({
fontSize: 12,
fontWeight: '200',
color: colors.primaryColor
})
.withKeyboardType('numeric')
.withOnEndEditing((e) => console.log('EndEditing', e.nativeEvent.text))
.withOnSubmitEditing((e) => console.log('SubmitEditing', e.nativeEvent.text))
.withOnTextChange((e) => console.log('TextChange', e))
.withOnChangeText((e) => console.log('ChangeText', e))
.build();
您好,我在 React 本机应用程序中使用浮动标签 (MKTextField)。我想知道如何从中获取文本。我试着在网上看,但没找到。
使用 React Native material 套件 "react-native-material-kit": "^0.5.1",
你能推荐一下吗
谢谢 R
<TextfieldWithFloatingLabel_Card ref="tiNumber"/>
const TextfieldWithFloatingLabel_Card = MKTextField.textfieldWithFloatingLabel()
.withPlaceholder('Last 4 digits of your dopay card')
.withStyle(styles.textfieldWithFloatingLabel)
.withTextInputStyle({flex: 1})
.withFloatingLabelFont({
fontSize: 12,
fontWeight: '200',
color: colors.primaryColor
})
.withKeyboardType('numeric')
.build();
获取文本有多个道具。考虑下面的代码
<TextfieldWithFloatingLabel_Card ref="tiNumber"/>
const TextfieldWithFloatingLabel_Card = MKTextField.textfieldWithFloatingLabel()
.withPlaceholder('Last 4 digits of your dopay card')
.withStyle(styles.textfieldWithFloatingLabel)
.withTextInputStyle({flex: 1})
.withFloatingLabelFont({
fontSize: 12,
fontWeight: '200',
color: colors.primaryColor
})
.withKeyboardType('numeric')
.withOnEndEditing((e) => console.log('EndEditing', e.nativeEvent.text))
.withOnSubmitEditing((e) => console.log('SubmitEditing', e.nativeEvent.text))
.withOnTextChange((e) => console.log('TextChange', e))
.withOnChangeText((e) => console.log('ChangeText', e))
.build();