react-native-gifted-chat 0.16.3 → 1.0.0-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/lib/Actions.d.ts +13 -11
- package/lib/Actions.js +28 -34
- package/lib/Actions.js.map +1 -1
- package/lib/Avatar.d.ts +5 -6
- package/lib/Avatar.js +34 -39
- package/lib/Avatar.js.map +1 -1
- package/lib/Bubble.d.ts +11 -8
- package/lib/Bubble.js +13 -7
- package/lib/Bubble.js.map +1 -1
- package/lib/Composer.d.ts +5 -11
- package/lib/Composer.js +34 -40
- package/lib/Composer.js.map +1 -1
- package/lib/Day.d.ts +7 -10
- package/lib/Day.js +15 -19
- package/lib/Day.js.map +1 -1
- package/lib/GiftedAvatar.js +3 -3
- package/lib/GiftedAvatar.js.map +1 -1
- package/lib/GiftedChat.d.ts +47 -38
- package/lib/GiftedChat.js +61 -36
- package/lib/GiftedChat.js.flow +8 -0
- package/lib/GiftedChat.js.map +1 -1
- package/lib/GiftedChatContext.d.ts +9 -0
- package/lib/GiftedChatContext.js +9 -0
- package/lib/GiftedChatContext.js.map +1 -0
- package/lib/InputToolbar.d.ts +14 -28
- package/lib/InputToolbar.js +27 -83
- package/lib/InputToolbar.js.map +1 -1
- package/lib/LoadEarlier.d.ts +4 -5
- package/lib/LoadEarlier.js +12 -25
- package/lib/LoadEarlier.js.map +1 -1
- package/lib/Message.d.ts +10 -7
- package/lib/Message.js +11 -9
- package/lib/Message.js.map +1 -1
- package/lib/MessageAudio.d.ts +1 -3
- package/lib/MessageAudio.js +11 -9
- package/lib/MessageAudio.js.map +1 -1
- package/lib/MessageContainer.d.ts +3 -8
- package/lib/MessageContainer.js +3 -41
- package/lib/MessageContainer.js.map +1 -1
- package/lib/MessageImage.d.ts +4 -5
- package/lib/MessageImage.js +12 -15
- package/lib/MessageImage.js.map +1 -1
- package/lib/MessageText.d.ts +5 -13
- package/lib/MessageText.js +79 -82
- package/lib/MessageText.js.map +1 -1
- package/lib/MessageVideo.d.ts +1 -3
- package/lib/MessageVideo.js +11 -9
- package/lib/MessageVideo.js.map +1 -1
- package/lib/Models.d.ts +3 -4
- package/lib/Models.js +1 -0
- package/lib/QuickReplies.d.ts +5 -15
- package/lib/QuickReplies.js +67 -87
- package/lib/QuickReplies.js.map +1 -1
- package/lib/Send.d.ts +6 -7
- package/lib/Send.js +16 -21
- package/lib/Send.js.map +1 -1
- package/lib/SystemMessage.d.ts +4 -5
- package/lib/SystemMessage.js +10 -12
- package/lib/SystemMessage.js.map +1 -1
- package/lib/Time.d.ts +5 -9
- package/lib/Time.js +33 -33
- package/lib/Time.js.map +1 -1
- package/lib/TypingIndicator.d.ts +0 -1
- package/lib/hooks/useUpdateLayoutEffect.d.ts +3 -2
- package/lib/hooks/useUpdateLayoutEffect.js +1 -1
- package/lib/hooks/useUpdateLayoutEffect.js.map +1 -1
- package/package.json +22 -19
package/lib/Composer.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Platform, StyleSheet, TextInput } from 'react-native';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
|
+
import { Platform, StyleSheet, TextInput, } from 'react-native';
|
|
4
4
|
import { MIN_COMPOSER_HEIGHT, DEFAULT_PLACEHOLDER } from './Constant';
|
|
5
5
|
import Color from './Color';
|
|
6
6
|
import { StylePropType } from './utils';
|
|
7
|
+
import { useCallbackOne } from 'use-memo-one';
|
|
7
8
|
const styles = StyleSheet.create({
|
|
8
9
|
textInput: {
|
|
9
10
|
flex: 1,
|
|
@@ -28,44 +29,37 @@ const styles = StyleSheet.create({
|
|
|
28
29
|
}),
|
|
29
30
|
},
|
|
30
31
|
});
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
(
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
outlineColor: 'transparent',
|
|
63
|
-
outlineOffset: 0,
|
|
64
|
-
},
|
|
65
|
-
}),
|
|
66
|
-
},
|
|
67
|
-
]} autoFocus={this.props.textInputAutoFocus} value={this.props.text} enablesReturnKeyAutomatically underlineColorAndroid='transparent' keyboardAppearance={this.props.keyboardAppearance} {...this.props.textInputProps}/>);
|
|
68
|
-
}
|
|
32
|
+
export function Composer(props) {
|
|
33
|
+
const { placeholder, onTextChanged, text } = props;
|
|
34
|
+
const layoutRef = useRef();
|
|
35
|
+
const handleOnLayout = useCallbackOne((e) => {
|
|
36
|
+
const { layout } = e.nativeEvent;
|
|
37
|
+
// Support earlier versions of React Native on Android.
|
|
38
|
+
if (!layout) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (!layoutRef ||
|
|
42
|
+
(layoutRef.current &&
|
|
43
|
+
(layoutRef.current.width !== layoutRef.current.width ||
|
|
44
|
+
layoutRef.current.height !== layoutRef.current.height))) {
|
|
45
|
+
layoutRef.current = layout;
|
|
46
|
+
props.onInputSizeChanged(layout);
|
|
47
|
+
}
|
|
48
|
+
}, [props.onInputSizeChanged]);
|
|
49
|
+
return (<TextInput testID={placeholder} accessible accessibilityLabel={placeholder} placeholder={placeholder} placeholderTextColor={props.placeholderTextColor} multiline={props.multiline} editable={!props.disableComposer} onLayout={handleOnLayout} onChangeText={onTextChanged} style={[
|
|
50
|
+
styles.textInput,
|
|
51
|
+
props.textInputStyle,
|
|
52
|
+
{
|
|
53
|
+
height: props.composerHeight,
|
|
54
|
+
...Platform.select({
|
|
55
|
+
web: {
|
|
56
|
+
outlineWidth: 0,
|
|
57
|
+
outlineColor: 'transparent',
|
|
58
|
+
outlineOffset: 0,
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
]} autoFocus={props.textInputAutoFocus} value={text} enablesReturnKeyAutomatically underlineColorAndroid='transparent' keyboardAppearance={props.keyboardAppearance} {...props.textInputProps}/>);
|
|
69
63
|
}
|
|
70
64
|
Composer.defaultProps = {
|
|
71
65
|
composerHeight: MIN_COMPOSER_HEIGHT,
|
package/lib/Composer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Composer.js","sourceRoot":"","sources":["../src/Composer.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"Composer.js","sourceRoot":"","sources":["../src/Composer.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EACL,QAAQ,EACR,UAAU,EACV,SAAS,GAGV,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AACrE,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,CAAC;QACP,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,GAAG,QAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,UAAU,EAAE,CAAC;gBACb,WAAW,EAAE,CAAC;aACf;SACF,C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,MAAM;IACtC,cAAc,EAAE,SAAS,CAAC,MAAM;IAChC,aAAa,EAAE,SAAS,CAAC,IAAI;IAC7B,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,SAAS,EAAE,SAAS,CAAC,IAAI;IACzB,eAAe,EAAE,SAAS,CAAC,IAAI;IAC/B,cAAc,EAAE,aAAa;IAC7B,kBAAkB,EAAE,SAAS,CAAC,IAAI;IAClC,kBAAkB,EAAE,SAAS,CAAC,MAAM;CACrC,CAAA"}
|
package/lib/Day.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
|
-
import {
|
|
3
|
-
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
2
|
+
import { StyleProp, ViewStyle, TextStyle, TextProps } from 'react-native';
|
|
4
3
|
import { IMessage } from './Models';
|
|
5
4
|
export interface DayProps<TMessage extends IMessage> {
|
|
6
5
|
currentMessage?: TMessage;
|
|
@@ -9,14 +8,13 @@ export interface DayProps<TMessage extends IMessage> {
|
|
|
9
8
|
containerStyle?: StyleProp<ViewStyle>;
|
|
10
9
|
wrapperStyle?: StyleProp<ViewStyle>;
|
|
11
10
|
textStyle?: StyleProp<TextStyle>;
|
|
11
|
+
textProps?: TextProps;
|
|
12
12
|
dateFormat?: string;
|
|
13
13
|
inverted?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
static defaultProps: {
|
|
15
|
+
export declare const Day: {
|
|
16
|
+
<TMessage extends IMessage = IMessage>({ dateFormat, currentMessage, previousMessage, containerStyle, wrapperStyle, textStyle, }: DayProps<TMessage>): JSX.Element | null;
|
|
17
|
+
defaultProps: {
|
|
20
18
|
currentMessage: {
|
|
21
19
|
createdAt: null;
|
|
22
20
|
};
|
|
@@ -27,7 +25,7 @@ export default class Day<TMessage extends IMessage = IMessage> extends PureCompo
|
|
|
27
25
|
textStyle: {};
|
|
28
26
|
dateFormat: string;
|
|
29
27
|
};
|
|
30
|
-
|
|
28
|
+
propTypes: {
|
|
31
29
|
currentMessage: PropTypes.Requireable<object>;
|
|
32
30
|
previousMessage: PropTypes.Requireable<object>;
|
|
33
31
|
nextMessage: PropTypes.Requireable<object>;
|
|
@@ -37,5 +35,4 @@ export default class Day<TMessage extends IMessage = IMessage> extends PureCompo
|
|
|
37
35
|
textStyle: PropTypes.Requireable<number | boolean | object>;
|
|
38
36
|
dateFormat: PropTypes.Requireable<string>;
|
|
39
37
|
};
|
|
40
|
-
|
|
41
|
-
}
|
|
38
|
+
};
|
package/lib/Day.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
|
-
import React, { PureComponent } from 'react';
|
|
3
3
|
import { StyleSheet, Text, View, } from 'react-native';
|
|
4
4
|
import dayjs from 'dayjs';
|
|
5
5
|
import Color from './Color';
|
|
6
6
|
import { StylePropType, isSameDay } from './utils';
|
|
7
7
|
import { DATE_FORMAT } from './Constant';
|
|
8
|
+
import { useChatContext } from './GiftedChatContext';
|
|
8
9
|
const styles = StyleSheet.create({
|
|
9
10
|
container: {
|
|
10
11
|
alignItems: 'center',
|
|
@@ -19,25 +20,20 @@ const styles = StyleSheet.create({
|
|
|
19
20
|
fontWeight: '600',
|
|
20
21
|
},
|
|
21
22
|
});
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
</View>);
|
|
35
|
-
}
|
|
36
|
-
return null;
|
|
23
|
+
export const Day = ({ dateFormat, currentMessage, previousMessage, containerStyle, wrapperStyle, textStyle, }) => {
|
|
24
|
+
const { getLocale } = useChatContext();
|
|
25
|
+
if (currentMessage && !isSameDay(currentMessage, previousMessage)) {
|
|
26
|
+
return (<View style={[styles.container, containerStyle]}>
|
|
27
|
+
<View style={wrapperStyle}>
|
|
28
|
+
<Text style={[styles.text, textStyle]}>
|
|
29
|
+
{dayjs(currentMessage.createdAt)
|
|
30
|
+
.locale(getLocale())
|
|
31
|
+
.format(dateFormat)}
|
|
32
|
+
</Text>
|
|
33
|
+
</View>
|
|
34
|
+
</View>);
|
|
37
35
|
}
|
|
38
|
-
|
|
39
|
-
Day.contextTypes = {
|
|
40
|
-
getLocale: PropTypes.func,
|
|
36
|
+
return null;
|
|
41
37
|
};
|
|
42
38
|
Day.defaultProps = {
|
|
43
39
|
currentMessage: {
|
package/lib/Day.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Day.js","sourceRoot":"","sources":["../src/Day.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Day.js","sourceRoot":"","sources":["../src/Day.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,EACL,UAAU,EACV,IAAI,EACJ,IAAI,GAKL,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,MAAM,SAAS,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,SAAS,EAAE;QACT,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,CAAC;QACZ,YAAY,EAAE,EAAE;KACjB;IACD,IAAI,EAAE;QACJ,eAAe,EAAE,KAAK,CAAC,qBAAqB;QAC5C,KAAK,EAAE,KAAK,CAAC,YAAY;QACzB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AAI;IACxB,cAAc,EAAE,aAAa;IAC7B,YAAY,EAAE,aAAa;IAC3B,SAAS,EAAE,aAAa;IACxB,UAAU,EAAE,SAAS,CAAC,MAAM;CAC7B,CAAA"}
|
package/lib/GiftedAvatar.js
CHANGED
|
@@ -92,10 +92,10 @@ export default class GiftedAvatar extends React.Component {
|
|
|
92
92
|
styles.avatarStyle,
|
|
93
93
|
styles.avatarTransparent,
|
|
94
94
|
this.props.avatarStyle,
|
|
95
|
-
]}
|
|
95
|
+
]} accessibilityRole='image'/>);
|
|
96
96
|
}
|
|
97
97
|
if (this.props.user.avatar) {
|
|
98
|
-
return (<TouchableOpacity disabled={!this.props.onPress} onPress={this.props.onPress} onLongPress={this.props.onLongPress}
|
|
98
|
+
return (<TouchableOpacity disabled={!this.props.onPress} onPress={this.props.onPress} onLongPress={this.props.onLongPress} accessibilityRole='image'>
|
|
99
99
|
{this.renderAvatar()}
|
|
100
100
|
</TouchableOpacity>);
|
|
101
101
|
}
|
|
@@ -104,7 +104,7 @@ export default class GiftedAvatar extends React.Component {
|
|
|
104
104
|
styles.avatarStyle,
|
|
105
105
|
{ backgroundColor: this.avatarColor },
|
|
106
106
|
this.props.avatarStyle,
|
|
107
|
-
]}
|
|
107
|
+
]} accessibilityRole='image'>
|
|
108
108
|
{this.renderInitials()}
|
|
109
109
|
</TouchableOpacity>);
|
|
110
110
|
}
|
package/lib/GiftedAvatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiftedAvatar.js","sourceRoot":"","sources":["../src/GiftedAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,YAAY,CAAA;AAClC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,KAAK,EACL,IAAI,EACJ,gBAAgB,EAChB,IAAI,EACJ,UAAU,GAIX,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,MAAM,SAAS,CAAA;AAE3B,OAAO,EAAE,aAAa,EAAE,MAAM,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IACvB,WAAW,EAAE,SAAS,CAAC,IAAI;IAC3B,WAAW,EAAE,aAAa;IAC1B,SAAS,EAAE,aAAa;CACzB,CAAA"}
|
package/lib/GiftedChat.d.ts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React, { RefObject } from 'react';
|
|
3
|
-
import { Animated, StyleProp, ViewStyle, FlatList, TextStyle } from 'react-native';
|
|
3
|
+
import { Animated, StyleProp, ViewStyle, FlatList, TextStyle, LayoutChangeEvent } from 'react-native';
|
|
4
4
|
import { ActionSheetOptions } from '@expo/react-native-action-sheet';
|
|
5
5
|
import * as utils from './utils';
|
|
6
|
-
import Actions from './Actions';
|
|
7
|
-
import Avatar from './Avatar';
|
|
6
|
+
import { Actions, ActionsProps } from './Actions';
|
|
7
|
+
import { Avatar, AvatarProps } from './Avatar';
|
|
8
8
|
import Bubble from './Bubble';
|
|
9
|
-
import SystemMessage from './SystemMessage';
|
|
10
|
-
import MessageImage from './MessageImage';
|
|
11
|
-
import MessageText from './MessageText';
|
|
12
|
-
import Composer from './Composer';
|
|
13
|
-
import Day from './Day';
|
|
14
|
-
import InputToolbar from './InputToolbar';
|
|
15
|
-
import LoadEarlier from './LoadEarlier';
|
|
9
|
+
import { SystemMessage, SystemMessageProps } from './SystemMessage';
|
|
10
|
+
import { MessageImage, MessageImageProps } from './MessageImage';
|
|
11
|
+
import { MessageText, MessageTextProps } from './MessageText';
|
|
12
|
+
import { Composer, ComposerProps } from './Composer';
|
|
13
|
+
import { Day, DayProps } from './Day';
|
|
14
|
+
import { InputToolbar, InputToolbarProps } from './InputToolbar';
|
|
15
|
+
import { LoadEarlier, LoadEarlierProps } from './LoadEarlier';
|
|
16
16
|
import Message from './Message';
|
|
17
17
|
import MessageContainer from './MessageContainer';
|
|
18
|
-
import Send from './Send';
|
|
19
|
-
import Time from './Time';
|
|
18
|
+
import { Send, SendProps } from './Send';
|
|
19
|
+
import { Time, TimeProps } from './Time';
|
|
20
|
+
import { QuickRepliesProps } from './QuickReplies';
|
|
20
21
|
import GiftedAvatar from './GiftedAvatar';
|
|
21
|
-
import { IMessage, User, Reply, LeftRightStyle } from './Models';
|
|
22
|
-
import QuickReplies from './QuickReplies';
|
|
22
|
+
import { IMessage, User, Reply, LeftRightStyle, MessageVideoProps, MessageAudioProps } from './Models';
|
|
23
23
|
export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
|
|
24
24
|
messages?: TMessage[];
|
|
25
25
|
isTyping?: boolean;
|
|
@@ -74,30 +74,32 @@ export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
|
|
|
74
74
|
onSend?(messages: TMessage[]): void;
|
|
75
75
|
onLoadEarlier?(): void;
|
|
76
76
|
renderLoading?(): React.ReactNode;
|
|
77
|
-
renderLoadEarlier?(props:
|
|
78
|
-
renderAvatar?(props:
|
|
77
|
+
renderLoadEarlier?(props: LoadEarlierProps): React.ReactNode;
|
|
78
|
+
renderAvatar?(props: AvatarProps<TMessage>): React.ReactNode | null;
|
|
79
79
|
renderBubble?(props: Bubble<TMessage>['props']): React.ReactNode;
|
|
80
|
-
renderSystemMessage?(props:
|
|
80
|
+
renderSystemMessage?(props: SystemMessageProps<TMessage>): React.ReactNode;
|
|
81
81
|
onLongPress?(context: any, message: any): void;
|
|
82
82
|
renderMessage?(message: Message<TMessage>['props']): React.ReactNode;
|
|
83
|
-
renderMessageText?(messageText:
|
|
84
|
-
renderMessageImage?(props:
|
|
83
|
+
renderMessageText?(messageText: MessageTextProps<TMessage>): React.ReactNode;
|
|
84
|
+
renderMessageImage?(props: MessageImageProps<TMessage>): React.ReactNode;
|
|
85
|
+
renderMessageVideo?(props: MessageVideoProps<TMessage>): React.ReactNode;
|
|
86
|
+
renderMessageAudio?(props: MessageAudioProps<TMessage>): React.ReactNode;
|
|
85
87
|
renderCustomView?(props: Bubble<TMessage>['props']): React.ReactNode;
|
|
86
|
-
renderDay?(props:
|
|
87
|
-
renderTime?(props:
|
|
88
|
+
renderDay?(props: DayProps<TMessage>): React.ReactNode;
|
|
89
|
+
renderTime?(props: TimeProps<TMessage>): React.ReactNode;
|
|
88
90
|
renderFooter?(): React.ReactNode;
|
|
89
91
|
renderChatEmpty?(): React.ReactNode;
|
|
90
92
|
renderChatFooter?(): React.ReactNode;
|
|
91
|
-
renderInputToolbar?(props:
|
|
92
|
-
renderComposer?(props:
|
|
93
|
-
renderActions?(props:
|
|
94
|
-
renderSend?(props:
|
|
95
|
-
renderAccessory?(props:
|
|
93
|
+
renderInputToolbar?(props: InputToolbarProps<TMessage>): React.ReactNode;
|
|
94
|
+
renderComposer?(props: ComposerProps): React.ReactNode;
|
|
95
|
+
renderActions?(props: ActionsProps): React.ReactNode;
|
|
96
|
+
renderSend?(props: SendProps<TMessage>): React.ReactNode;
|
|
97
|
+
renderAccessory?(props: InputToolbarProps<TMessage>): React.ReactNode;
|
|
96
98
|
onPressActionButton?(): void;
|
|
97
99
|
onInputTextChanged?(text: string): void;
|
|
98
100
|
parsePatterns?(linkStyle: TextStyle): any;
|
|
99
101
|
onQuickReply?(replies: Reply[]): void;
|
|
100
|
-
renderQuickReplies?(quickReplies:
|
|
102
|
+
renderQuickReplies?(quickReplies: QuickRepliesProps): React.ReactNode;
|
|
101
103
|
renderQuickReplySend?(): React.ReactNode;
|
|
102
104
|
scrollToBottomComponent?(): React.ReactNode;
|
|
103
105
|
shouldUpdateMessage?(props: Message<TMessage>['props'], nextProps: Message<TMessage>['props']): boolean;
|
|
@@ -111,10 +113,6 @@ export interface GiftedChatState<TMessage extends IMessage = IMessage> {
|
|
|
111
113
|
messages?: TMessage[];
|
|
112
114
|
}
|
|
113
115
|
declare class GiftedChat<TMessage extends IMessage = IMessage> extends React.Component<GiftedChatProps<TMessage>, GiftedChatState> {
|
|
114
|
-
static childContextTypes: {
|
|
115
|
-
actionSheet: PropTypes.Requireable<(...args: any[]) => any>;
|
|
116
|
-
getLocale: PropTypes.Requireable<(...args: any[]) => any>;
|
|
117
|
-
};
|
|
118
116
|
static defaultProps: {
|
|
119
117
|
messages: never[];
|
|
120
118
|
messagesContainerStyle: undefined;
|
|
@@ -145,6 +143,8 @@ declare class GiftedChat<TMessage extends IMessage = IMessage> extends React.Com
|
|
|
145
143
|
renderMessage: null;
|
|
146
144
|
renderMessageText: null;
|
|
147
145
|
renderMessageImage: null;
|
|
146
|
+
renderMessageVideo: null;
|
|
147
|
+
renderMessageAudio: null;
|
|
148
148
|
imageProps: {};
|
|
149
149
|
videoProps: {};
|
|
150
150
|
audioProps: {};
|
|
@@ -165,7 +165,7 @@ declare class GiftedChat<TMessage extends IMessage = IMessage> extends React.Com
|
|
|
165
165
|
renderAccessory: null;
|
|
166
166
|
isKeyboardInternallyHandled: boolean;
|
|
167
167
|
onPressActionButton: null;
|
|
168
|
-
bottomOffset:
|
|
168
|
+
bottomOffset: null;
|
|
169
169
|
minInputToolbarHeight: number;
|
|
170
170
|
keyboardShouldPersistTaps: string;
|
|
171
171
|
onInputTextChanged: null;
|
|
@@ -252,6 +252,7 @@ declare class GiftedChat<TMessage extends IMessage = IMessage> extends React.Com
|
|
|
252
252
|
invertibleScrollViewProps: any;
|
|
253
253
|
_actionSheetRef: any;
|
|
254
254
|
_messageContainerRef?: RefObject<FlatList<IMessage>>;
|
|
255
|
+
_isTextInputWasFocused: boolean;
|
|
255
256
|
textInput?: any;
|
|
256
257
|
state: {
|
|
257
258
|
isInitialized: boolean;
|
|
@@ -262,10 +263,6 @@ declare class GiftedChat<TMessage extends IMessage = IMessage> extends React.Com
|
|
|
262
263
|
messages: undefined;
|
|
263
264
|
};
|
|
264
265
|
constructor(props: GiftedChatProps<TMessage>);
|
|
265
|
-
getChildContext(): {
|
|
266
|
-
actionSheet: () => any;
|
|
267
|
-
getLocale: () => string;
|
|
268
|
-
};
|
|
269
266
|
componentDidMount(): void;
|
|
270
267
|
componentWillUnmount(): void;
|
|
271
268
|
componentDidUpdate(prevProps?: GiftedChatProps<TMessage>): void;
|
|
@@ -298,7 +295,19 @@ declare class GiftedChat<TMessage extends IMessage = IMessage> extends React.Com
|
|
|
298
295
|
* Returns the height, based on current window size, taking the keyboard into account.
|
|
299
296
|
*/
|
|
300
297
|
getMessagesContainerHeightWithKeyboard(composerHeight?: number | undefined): number;
|
|
301
|
-
safeAreaSupport: (bottomOffset
|
|
298
|
+
safeAreaSupport: (bottomOffset?: number | undefined) => number;
|
|
299
|
+
/**
|
|
300
|
+
* Store text input focus status when keyboard hide to retrieve
|
|
301
|
+
* it after wards if needed.
|
|
302
|
+
* `onKeyboardWillHide` may be called twice in sequence so we
|
|
303
|
+
* make a guard condition (eg. showing image picker)
|
|
304
|
+
*/
|
|
305
|
+
handleTextInputFocusWhenKeyboardHide(): void;
|
|
306
|
+
/**
|
|
307
|
+
* Refocus the text input only if it was focused before showing keyboard.
|
|
308
|
+
* This is needed in some cases (eg. showing image picker).
|
|
309
|
+
*/
|
|
310
|
+
handleTextInputFocusWhenKeyboardShow(): void;
|
|
302
311
|
onKeyboardWillShow: (e: any) => void;
|
|
303
312
|
onKeyboardWillHide: (_e: any) => void;
|
|
304
313
|
onKeyboardDidShow: (e: any) => void;
|
|
@@ -314,7 +323,7 @@ declare class GiftedChat<TMessage extends IMessage = IMessage> extends React.Com
|
|
|
314
323
|
onInputTextChanged: (text: string) => void;
|
|
315
324
|
notifyInputTextReset(): void;
|
|
316
325
|
onInitialLayoutViewLayout: (e: any) => void;
|
|
317
|
-
onMainViewLayout: (e:
|
|
326
|
+
onMainViewLayout: (e: LayoutChangeEvent) => void;
|
|
318
327
|
renderInputToolbar(): {} | null | undefined;
|
|
319
328
|
renderChatFooter(): {} | null | undefined;
|
|
320
329
|
renderLoading(): {} | null | undefined;
|
package/lib/GiftedChat.js
CHANGED
|
@@ -7,20 +7,21 @@ import { getBottomSpace } from 'react-native-iphone-x-helper';
|
|
|
7
7
|
import dayjs from 'dayjs';
|
|
8
8
|
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
9
9
|
import * as utils from './utils';
|
|
10
|
-
import Actions from './Actions';
|
|
11
|
-
import Avatar from './Avatar';
|
|
10
|
+
import { Actions } from './Actions';
|
|
11
|
+
import { Avatar } from './Avatar';
|
|
12
12
|
import Bubble from './Bubble';
|
|
13
|
-
import SystemMessage from './SystemMessage';
|
|
14
|
-
import MessageImage from './MessageImage';
|
|
15
|
-
import MessageText from './MessageText';
|
|
16
|
-
import Composer from './Composer';
|
|
17
|
-
import Day from './Day';
|
|
18
|
-
import InputToolbar from './InputToolbar';
|
|
19
|
-
import LoadEarlier from './LoadEarlier';
|
|
13
|
+
import { SystemMessage } from './SystemMessage';
|
|
14
|
+
import { MessageImage } from './MessageImage';
|
|
15
|
+
import { MessageText } from './MessageText';
|
|
16
|
+
import { Composer } from './Composer';
|
|
17
|
+
import { Day } from './Day';
|
|
18
|
+
import { InputToolbar } from './InputToolbar';
|
|
19
|
+
import { LoadEarlier } from './LoadEarlier';
|
|
20
20
|
import Message from './Message';
|
|
21
21
|
import MessageContainer from './MessageContainer';
|
|
22
|
-
import Send from './Send';
|
|
23
|
-
import
|
|
22
|
+
import { Send } from './Send';
|
|
23
|
+
import { GiftedChatContext } from './GiftedChatContext';
|
|
24
|
+
import { Time } from './Time';
|
|
24
25
|
import GiftedAvatar from './GiftedAvatar';
|
|
25
26
|
import { MIN_COMPOSER_HEIGHT, MAX_COMPOSER_HEIGHT, DEFAULT_PLACEHOLDER, TIME_FORMAT, DATE_FORMAT, } from './Constant';
|
|
26
27
|
dayjs.extend(localizedFormat);
|
|
@@ -36,6 +37,7 @@ class GiftedChat extends React.Component {
|
|
|
36
37
|
this.invertibleScrollViewProps = undefined;
|
|
37
38
|
this._actionSheetRef = undefined;
|
|
38
39
|
this._messageContainerRef = React.createRef();
|
|
40
|
+
this._isTextInputWasFocused = false;
|
|
39
41
|
this.state = {
|
|
40
42
|
isInitialized: false,
|
|
41
43
|
composerHeight: this.props.minComposerHeight,
|
|
@@ -46,13 +48,10 @@ class GiftedChat extends React.Component {
|
|
|
46
48
|
};
|
|
47
49
|
this.getLocale = () => this._locale;
|
|
48
50
|
this.safeAreaSupport = (bottomOffset) => {
|
|
49
|
-
return bottomOffset
|
|
50
|
-
? this.getBottomOffset()
|
|
51
|
-
? this.getBottomOffset()
|
|
52
|
-
: getBottomSpace()
|
|
53
|
-
: bottomOffset;
|
|
51
|
+
return bottomOffset != null ? bottomOffset : getBottomSpace();
|
|
54
52
|
};
|
|
55
53
|
this.onKeyboardWillShow = (e) => {
|
|
54
|
+
this.handleTextInputFocusWhenKeyboardShow();
|
|
56
55
|
if (this.props.isKeyboardInternallyHandled) {
|
|
57
56
|
this.setIsTypingDisabled(true);
|
|
58
57
|
this.setKeyboardHeight(e.endCoordinates ? e.endCoordinates.height : e.end.height);
|
|
@@ -64,6 +63,7 @@ class GiftedChat extends React.Component {
|
|
|
64
63
|
}
|
|
65
64
|
};
|
|
66
65
|
this.onKeyboardWillHide = (_e) => {
|
|
66
|
+
this.handleTextInputFocusWhenKeyboardHide();
|
|
67
67
|
if (this.props.isKeyboardInternallyHandled) {
|
|
68
68
|
this.setIsTypingDisabled(true);
|
|
69
69
|
this.setKeyboardHeight(0);
|
|
@@ -151,7 +151,7 @@ class GiftedChat extends React.Component {
|
|
|
151
151
|
});
|
|
152
152
|
};
|
|
153
153
|
this.onMainViewLayout = (e) => {
|
|
154
|
-
// fix an issue when keyboard is dismissing during the initialization
|
|
154
|
+
// TODO: fix an issue when keyboard is dismissing during the initialization
|
|
155
155
|
const { layout } = e.nativeEvent;
|
|
156
156
|
if (this.getMaxHeight() !== layout.height ||
|
|
157
157
|
this.getIsFirstLayout() === true) {
|
|
@@ -191,12 +191,6 @@ class GiftedChat extends React.Component {
|
|
|
191
191
|
? currentMessages.concat(messages)
|
|
192
192
|
: messages.concat(currentMessages);
|
|
193
193
|
}
|
|
194
|
-
getChildContext() {
|
|
195
|
-
return {
|
|
196
|
-
actionSheet: this.props.actionSheet || (() => this._actionSheetRef.getContext()),
|
|
197
|
-
getLocale: this.getLocale,
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
194
|
componentDidMount() {
|
|
201
195
|
const { messages, text } = this.props;
|
|
202
196
|
this.setIsMounted(true);
|
|
@@ -318,6 +312,31 @@ class GiftedChat extends React.Component {
|
|
|
318
312
|
this.getKeyboardHeight() +
|
|
319
313
|
this.getBottomOffset());
|
|
320
314
|
}
|
|
315
|
+
/**
|
|
316
|
+
* Store text input focus status when keyboard hide to retrieve
|
|
317
|
+
* it after wards if needed.
|
|
318
|
+
* `onKeyboardWillHide` may be called twice in sequence so we
|
|
319
|
+
* make a guard condition (eg. showing image picker)
|
|
320
|
+
*/
|
|
321
|
+
handleTextInputFocusWhenKeyboardHide() {
|
|
322
|
+
var _a;
|
|
323
|
+
if (!this._isTextInputWasFocused) {
|
|
324
|
+
this._isTextInputWasFocused = ((_a = this.textInput) === null || _a === void 0 ? void 0 : _a.isFocused()) || false;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Refocus the text input only if it was focused before showing keyboard.
|
|
329
|
+
* This is needed in some cases (eg. showing image picker).
|
|
330
|
+
*/
|
|
331
|
+
handleTextInputFocusWhenKeyboardShow() {
|
|
332
|
+
if (this.textInput &&
|
|
333
|
+
this._isTextInputWasFocused &&
|
|
334
|
+
!this.textInput.isFocused()) {
|
|
335
|
+
this.textInput.focus();
|
|
336
|
+
}
|
|
337
|
+
// Reset the indicator since the keyboard is shown
|
|
338
|
+
this._isTextInputWasFocused = false;
|
|
339
|
+
}
|
|
321
340
|
scrollToBottom(animated = true) {
|
|
322
341
|
if (this._messageContainerRef && this._messageContainerRef.current) {
|
|
323
342
|
const { inverted } = this.props;
|
|
@@ -403,24 +422,27 @@ class GiftedChat extends React.Component {
|
|
|
403
422
|
if (this.state.isInitialized === true) {
|
|
404
423
|
const { wrapInSafeArea } = this.props;
|
|
405
424
|
const Wrapper = wrapInSafeArea ? SafeAreaView : View;
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
<
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
425
|
+
const actionSheet = this.props.actionSheet || (() => this._actionSheetRef.getContext());
|
|
426
|
+
const { getLocale } = this;
|
|
427
|
+
return (<GiftedChatContext.Provider value={{
|
|
428
|
+
actionSheet,
|
|
429
|
+
getLocale,
|
|
430
|
+
}}>
|
|
431
|
+
<Wrapper style={styles.safeArea}>
|
|
432
|
+
<ActionSheetProvider ref={(component) => (this._actionSheetRef = component)}>
|
|
433
|
+
<View style={styles.container} onLayout={this.onMainViewLayout}>
|
|
434
|
+
{this.renderMessages()}
|
|
435
|
+
{this.renderInputToolbar()}
|
|
436
|
+
</View>
|
|
437
|
+
</ActionSheetProvider>
|
|
438
|
+
</Wrapper>
|
|
439
|
+
</GiftedChatContext.Provider>);
|
|
414
440
|
}
|
|
415
441
|
return (<View style={styles.container} onLayout={this.onInitialLayoutViewLayout}>
|
|
416
442
|
{this.renderLoading()}
|
|
417
443
|
</View>);
|
|
418
444
|
}
|
|
419
445
|
}
|
|
420
|
-
GiftedChat.childContextTypes = {
|
|
421
|
-
actionSheet: PropTypes.func,
|
|
422
|
-
getLocale: PropTypes.func,
|
|
423
|
-
};
|
|
424
446
|
GiftedChat.defaultProps = {
|
|
425
447
|
messages: [],
|
|
426
448
|
messagesContainerStyle: undefined,
|
|
@@ -451,6 +473,8 @@ GiftedChat.defaultProps = {
|
|
|
451
473
|
renderMessage: null,
|
|
452
474
|
renderMessageText: null,
|
|
453
475
|
renderMessageImage: null,
|
|
476
|
+
renderMessageVideo: null,
|
|
477
|
+
renderMessageAudio: null,
|
|
454
478
|
imageProps: {},
|
|
455
479
|
videoProps: {},
|
|
456
480
|
audioProps: {},
|
|
@@ -471,7 +495,7 @@ GiftedChat.defaultProps = {
|
|
|
471
495
|
renderAccessory: null,
|
|
472
496
|
isKeyboardInternallyHandled: true,
|
|
473
497
|
onPressActionButton: null,
|
|
474
|
-
bottomOffset:
|
|
498
|
+
bottomOffset: null,
|
|
475
499
|
minInputToolbarHeight: 44,
|
|
476
500
|
keyboardShouldPersistTaps: Platform.select({
|
|
477
501
|
ios: 'never',
|
|
@@ -559,5 +583,6 @@ const styles = StyleSheet.create({
|
|
|
559
583
|
flex: 1,
|
|
560
584
|
},
|
|
561
585
|
});
|
|
586
|
+
export * from './Models';
|
|
562
587
|
export { GiftedChat, Actions, Avatar, Bubble, SystemMessage, MessageImage, MessageText, Composer, Day, InputToolbar, LoadEarlier, Message, MessageContainer, Send, Time, GiftedAvatar, utils, };
|
|
563
588
|
//# sourceMappingURL=GiftedChat.js.map
|
package/lib/GiftedChat.js.flow
CHANGED
|
@@ -10,6 +10,10 @@ import SystemMessage from './SystemMessage'
|
|
|
10
10
|
import type { SystemMessageProps } from './SystemMessage'
|
|
11
11
|
import MessageImage from './MessageImage'
|
|
12
12
|
import type { MessageImageProps } from './MessageImage'
|
|
13
|
+
import MessageVideo from './MessageVideo'
|
|
14
|
+
import type { MessageVideoProps } from './MessageVideo'
|
|
15
|
+
import MessageAudio from './MessageAudio'
|
|
16
|
+
import type { MessageAudioProps } from './MessageAudio'
|
|
13
17
|
import MessageText from './MessageText'
|
|
14
18
|
import type { MessageTextProps } from './MessageText'
|
|
15
19
|
import Composer from './Composer'
|
|
@@ -96,6 +100,8 @@ export type GiftedChatProps<TMessage: IMessage = IMessage> = $ReadOnly<{|
|
|
|
96
100
|
renderMessage?: (MessageProps<TMessage>) => React.Node,
|
|
97
101
|
renderMessageText?: (MessageTextProps<TMessage>) => React.Node,
|
|
98
102
|
renderMessageImage?: (MessageImageProps<TMessage>) => React.Node,
|
|
103
|
+
renderMessageVideo?: (MessageVideoProps<TMessage>) => React.Node,
|
|
104
|
+
renderMessageAudio?: (MessageAudioProps<TMessage>) => React.Node,
|
|
99
105
|
renderCustomView?: (BubbleProps<TMessage>) => React.Node,
|
|
100
106
|
renderDay?: (DayProps<TMessage>) => React.Node,
|
|
101
107
|
renderTime?: (TimeProps<TMessage>) => React.Node,
|
|
@@ -140,6 +146,8 @@ export {
|
|
|
140
146
|
Bubble,
|
|
141
147
|
SystemMessage,
|
|
142
148
|
MessageImage,
|
|
149
|
+
MessageVideo,
|
|
150
|
+
MessageAudio,
|
|
143
151
|
MessageText,
|
|
144
152
|
Composer,
|
|
145
153
|
Day,
|