CommentInput.js 2.88 KB
import React, {Component} from 'react';
import {
    Image,
    InteractionManager,
    Keyboard,
    KeyboardAvoidingView,
    NativeModules,
    Platform,
    StyleSheet,
    Text,
    TextInput,
    TouchableOpacity,
    View,
    ScrollView
} from 'react-native';
import {zoomH, zoomW} from '../../utils/getSize';
import EmojiSelector, {Categories} from 'react-native-emoji-selector';
import AppService from "../../service/AppService";
import {isIphoneX, getHomeColor,NoDoublePress,xnToast} from '../../utils/utils';

import CommentInputAndroid from './CommentInputAndroid';
import CommentInputIos from './CommentInputIos';


/**
 * 详情-评论输入框
 */
export default class CommentInput extends Component {
    // 构造
    constructor(props) {
        super(props);
    }


    reset(){
        this.refs.CommentInput.reset();
    }


    setMinLength(length){
        this.refs.CommentInput.setMinLength(length);
    }

    setDefaultValue(value){
        this.refs.CommentInput.setDefaultValue(value);
    }

    setCustomPublish(){
        this.refs.CommentInput.setCustomPublish();
    }

    showInputLayout(){
        this.refs.CommentInput.showInputLayout();
    }

    focus(){
        if(this.refs.CommentInput != undefined){
            this.refs.CommentInput.focus()
        }
    }

    render() {
        if (Platform.OS == 'android'){
            return(
                <CommentInputAndroid  ref = "CommentInput"
                               boardId = {this.props.boardId}
                               callback = { this.props.callback}
                               uploadCallback = {this.props.uploadCallback}
                               nav = {this.props.nav}
                               hasNavHeight = {!!this.props.hasNavHeight?this.props.hasNavHeight:false}
                               isEdit = {!!this.props.isEdit?this.props.isEdit:false}
                               hideForward = {!!this.props.hideForward?this.props.hideForward:false}
                >

                </CommentInputAndroid>
            );

        }else {
            return(
                <CommentInputIos  ref = "CommentInput"
                                      boardId = {!!this.props.boardId?this.props.boardId:0}
                                      callback = { !!this.props.callback?this.props.callback:()=>{}}
                                      uploadCallback = {!!this.props.uploadCallback?this.props.uploadCallback:()=>{}}
                                      nav = {!!this.props.nav?this.props.nav:()=>{}}
                                      hasNavHeight = {!!this.props.hasNavHeight?this.props.hasNavHeight:false}
                                      isEdit = {!!this.props.isEdit?this.props.isEdit:false}
                                      hideForward = {!!this.props.hideForward?this.props.hideForward:false}

                >
                </CommentInputIos>)

                }

    }

}