Skip to content

[React Native 0.81+] Android: StatusBar changes automatically | iOS: Cannot type in Composer #2661

@Rajubarde12

Description

@Rajubarde12

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-gifted-chat/lib/Composer.js b/node_modules/react-native-gifted-chat/lib/Composer.js
index becd702..c8aacf8 100644
--- a/node_modules/react-native-gifted-chat/lib/Composer.js
+++ b/node_modules/react-native-gifted-chat/lib/Composer.js
@@ -3,7 +3,7 @@ import { Platform, StyleSheet, TextInput, } from 'react-native';
 import { MIN_COMPOSER_HEIGHT, DEFAULT_PLACEHOLDER } from './Constant';
 import Color from './Color';
 import stylesCommon from './styles';
-export function Composer({ composerHeight = MIN_COMPOSER_HEIGHT, disableComposer = false, keyboardAppearance = 'default', multiline = true, onInputSizeChanged, onTextChanged, placeholder = DEFAULT_PLACEHOLDER, placeholderTextColor = Color.defaultColor, text = '', textInputAutoFocus = false, textInputProps, textInputStyle, }) {
+export function Composer({ composerHeight = MIN_COMPOSER_HEIGHT, disableComposer = false, keyboardAppearance = 'default', multiline = true, onInputSizeChanged, onTextChanged, placeholder = DEFAULT_PLACEHOLDER, placeholderTextColor = Color.defaultColor, text = '', textInputAutoFocus = false, textInputProps,ref, textInputStyle, }) {
     const dimensionsRef = useRef(null);
     const determineInputSizeChange = useCallback((dimensions) => {
         // Support earlier versions of React Native on Android.
@@ -32,7 +32,7 @@ export function Composer({ composerHeight = MIN_COMPOSER_HEIGHT, disableComposer
                     },
                 }),
             },
-        ]} autoFocus={textInputAutoFocus} value={text} enablesReturnKeyAutomatically underlineColorAndroid='transparent' keyboardAppearance={keyboardAppearance} {...textInputProps}/>);
+        ]}autoFocus={textInputAutoFocus} value={text} enablesReturnKeyAutomatically underlineColorAndroid='transparent' keyboardAppearance={keyboardAppearance} ref={ref}/>);
 }
 const styles = StyleSheet.create({
     textInput: {
diff --git a/node_modules/react-native-gifted-chat/lib/GiftedChat/index.js b/node_modules/react-native-gifted-chat/lib/GiftedChat/index.js
index 4fc42d2..2516eb0 100644
--- a/node_modules/react-native-gifted-chat/lib/GiftedChat/index.js
+++ b/node_modules/react-native-gifted-chat/lib/GiftedChat/index.js
@@ -6,6 +6,7 @@ import { Platform, View, } from 'react-native';
 import { Actions } from '../Actions';
 import { Avatar } from '../Avatar';
 import Bubble from '../Bubble';
+import {Platform as LocalPlatform} from 'react-native'
 import { Composer } from '../Composer';
 import { MAX_COMPOSER_HEIGHT, MIN_COMPOSER_HEIGHT, TEST_ID } from '../Constant';
 import { Day } from '../Day';
@@ -195,9 +196,9 @@ function GiftedChat(props) {
             onSend: _onSend,
             onInputSizeChanged,
             onTextChanged: _onInputTextChanged,
+              ref: textInputRef,
             textInputProps: {
                 ...textInputProps,
-                ref: textInputRef,
                 maxLength: isTypingDisabled ? 0 : maxInputLength,
             },
         };
@@ -279,9 +280,9 @@ function GiftedChat(props) {
     </GiftedChatContext.Provider>);
 }
 function GiftedChatWrapper(props) {
-    return (<KeyboardProvider>
-      <GiftedChat {...props}/>
-    </KeyboardProvider>);
+    return LocalPlatform.OS=='ios'? ( <KeyboardProvider>
+           <GiftedChat {...props}/>
+            </KeyboardProvider>):   <GiftedChat {...props}/>;
 }
 GiftedChatWrapper.append = (currentMessages = [], messages, inverted = true) => {
     if (!Array.isArray(messages))

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions