GithubHelp home page GithubHelp logo

Comments (7)

demchenkoalex avatar demchenkoalex commented on June 2, 2024 2

@AromdeSalaxy yes, I had the same problem, just move everything you have under <KeyboardAccessoryView including the TextInput to the separate component/file and use setState there - only that component will be re-rendered.

from react-native-keyboard-accessory-view.

aromdeskalaxy avatar aromdeskalaxy commented on June 2, 2024 1

@demchenkoalex thank you so much

from react-native-keyboard-accessory-view.

demchenkoalex avatar demchenkoalex commented on June 2, 2024

Hi @AromdeSalaxy

Can you please elaborate? KeyboardAccessoryView just renders children, it does not contain any logic for opening or closing the keyboard. What setState do you mean?

from react-native-keyboard-accessory-view.

aromdeskalaxy avatar aromdeskalaxy commented on June 2, 2024
  const RenderCommentInput = () => {
    return (
      <View style={styles.postCommentContainer}>
          <TextInput
            style={styles.inputPostCom}
            multiline
            numberOfLines={10}
            // onChangeText={onMessageChange}
            value={message}
            onChangeText={setMessage}
          />
      </View>
    );
  };


  return (
    <SafeAreaView style={styles.safeAreaView}>
      <Header title={t('Comment')} />
      <KeyboardAccessoryView
        renderScrollable={renderScrollable}
        children={<RenderCommentInput />}
      />
    </SafeAreaView>
  );

it happened when i call

value={message}
onChangeText={setMessage}

from react-native-keyboard-accessory-view.

aromdeskalaxy avatar aromdeskalaxy commented on June 2, 2024

i guess view is re-render inside KeyboardAccessoryView children

from react-native-keyboard-accessory-view.

demchenkoalex avatar demchenkoalex commented on June 2, 2024

I have a similar setup in the project and it doesn't close the keyboard, I will try to re-create your code and see what's going on

from react-native-keyboard-accessory-view.

aromdeskalaxy avatar aromdeskalaxy commented on June 2, 2024
  const RenderScrollable = () => (
    <FlatList
      ref={refList}
      keyboardDismissMode="interactive"
      data={comments}
      {...PanGestureHandler}
      ListHeaderComponent={<RenderOwnerPost post={post} profile={profile} />}
      renderItem={({ item, index }) => {
        return <RenderCommentCard key={item.id} comment={item} />;
      }}
      contentContainerStyle={{ paddingVertical: 16, paddingBottom: 50 }}
      keyExtractor={(item) => item.id.toString()}
    />
  );

   return (
    <SafeAreaView style={styles.safeAreaView}>
      <Header title={t('Comment')} />
      <KeyboardAccessoryView renderScrollable={RenderScrollable}>
        <View style={styles.postCommentContainer}>
          <View style={styles.postComInputContainer}>
            <TextInput
              style={styles.inputPostCom}
              multiline
              numberOfLines={10}
              value={message}
              onChangeText={setMessage}
            />
          </View>
          <View style={styles.btnSend}>
            <TouchableOpacity onPress={() => sendComment({ id: profile.id })}>
              <Icon.SendCircleFilled width={24} height={24} />
            </TouchableOpacity>
          </View>
        </View>
      </KeyboardAccessoryView>
    </SafeAreaView>
  );

this code keyboard not dismiss
but renderScrollable will re-render when TextInput call onChangeText

from react-native-keyboard-accessory-view.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.