Native-base Input,textarea and other components cannot be entered in Chinese under iOS platform

Source: Internet
Author: User

In react-native above, TextInput cannot enter Chinese in the iOS platform has been resolved.

But native-base there are problems with both input and textarea. In order not to write multiple components, encapsulate the following code:

import React from ‘react‘;import PropTypes from ‘prop-types‘;import {  Platform,} from ‘react-native‘;import {  Textarea,  Input,} from ‘native-base‘;export const inputSupportLanguage = (WrappedComponent) => {  class InputSupportLanguage extends React.Component {    shouldComponentUpdate(nextProps) {      const { value, defaultValue } = this.props;      return Platform.OS !== ‘ios‘      || (value === nextProps.value && !nextProps.defaultValue)      || (defaultValue === nextProps.defaultValue && !nextProps.value);    }    render() {      return <WrappedComponent {...this.props} />;    }  }  InputSupportLanguage.propTypes = {    value: PropTypes.string,    defaultValue: PropTypes.string,  };  return InputSupportLanguage;};export const NBInput = inputSupportLanguage(Input);export const NBTextarea = inputSupportLanguage(Textarea);

In the corresponding file, you can import the components you need to use, like using input and textarea in native-base. eg

import {  NBInput,  NBTextarea,} from ‘utils/inputSupportLanguage‘;

Native-base Input,textarea and other components cannot be entered in Chinese under iOS platform

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.