当我试图构建一个iPhone应用程序时,我是一个新手,对本机做出反应,并且遇到了这个问题。
我的代码是:
var React = require('react-native');
var MyListView = require('./MyListView'); // which renders a <ListView>...</ListView>
var SearchPage = React.createClass({
onSubmitEditing: function () { /* do something */ },
我希望在react本机中保存字段输入的值。如何使用onSubmitediting事件将值发送到异步函数?
我试过这个:
<TextInput onSubmitEditing={ (text) => this.Store(text)}></TextInput>
这是我使用的函数
Store = async() =>
{
var textvalue = "here the value of the <TextInput>";
try
{
await AsyncStorage.setItem(&
使用react-final-form,我无法forwardRef到我的TextInput以响应本机。ref用于处理键盘中的Next按钮和其他表单中的强制焦点事件。
我的设置如下所示-请注意,为了简单起见,已经删除了一些代码,这样就不会剪切和粘贴。
// FormInputGroup/index.js
import React from 'react'
import PropTypes from 'prop-types'
import { Field } from 'react-final-form'
const FormInputGroup
我正在创建一个自定义组件,脚本是使用React的钩子用TypeScript编写的
我的组件将使用我的一些类型记录类型,并将其与TextInput类型混合(这样我就可以访问TextInput支持)
这是我的自定义组件示例代码
import { Animated, Platform, TextInput, TextInputProps, View } from 'react-native'
type PropsType = TextInputProps & { //Or should I using TextInput instead of TextInputProps?
编辑:我是ReactNative的新手,我正试图在我的TextBoxes上写作。然而,我不能进入任何东西。我尝试添加redux表单来注册屏幕。这是我的Signup.js:
import React, { Component } from 'react';
import {StyleSheet, Text, View, StatusBar, TouchableOpacity} from 'react-native';
import {Field, reduxForm} from 'redux-form';
import Logo from
将组件的呈现方法拆分为函数是否被视为反模式?
我的意思是,如果JSX太大的话,我们可以把它分成更多的组件。
但是,下面的例子是什么呢?
/**
* Renders the text inputs of the form.
*
* @returns {React.ReactElement} The text inputs.
*/
const renderInputs = () => (
<View style={styles.inputsContainer}>
<UsernameInput
ref={us