Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-easy-chat-ui

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-easy-chat-ui - npm Package Compare versions

Comparing version 0.2.5 to 0.2.6

41

app/chat/ChatView.js

@@ -18,3 +18,3 @@ import React, { PureComponent } from 'react'

import PropTypes from 'prop-types'
import { getCurrentTime, changeEmojiText } from './utils'
import { getCurrentTime, changeEmojiText, isIPhoneX } from './utils'
import Voice from './VoiceView'

@@ -49,3 +49,2 @@ import PopView from './components/pop-view'

reSendMessage: PropTypes.func,
isIphoneX: PropTypes.bool.isRequired,
androidHeaderHeight: PropTypes.number.isRequired,

@@ -120,3 +119,4 @@ iphoneXHeaderPadding: PropTypes.number,

audioHasPermission: PropTypes.bool,
checkAndroidPermission: PropTypes.func,
checkPermission: PropTypes.func,
requestAndroidPermission: PropTypes.func,
voiceErrorText: PropTypes.string,

@@ -163,3 +163,2 @@ voiceCancelText: PropTypes.string,

onEndReachedThreshold: 0.1,
isIphoneX: true,
usePopView: true,

@@ -318,3 +317,4 @@ userProfile: {

audioHasPermission: false,
checkAndroidPermission: () => {},
checkPermission: () => {},
requestAndroidPermission: () => {},
voiceErrorText: '说话时间太短',

@@ -335,3 +335,3 @@ voiceCancelText: '松开手指取消发送',

that = this
const { isIphoneX, chatId, androidHeaderHeight, chatType, iphoneXHeaderPadding, iphoneXBottomPadding } = props
const { chatId, androidHeaderHeight, chatType, iphoneXHeaderPadding, iphoneXBottomPadding } = props
this.targetKey = `${chatType}_${chatId}`

@@ -341,2 +341,3 @@ this.time = null

this.iosHeaderHeight = 64
this.isIphoneX = isIPhoneX()
this.visibleHeight = new Animated.Value(0)

@@ -347,6 +348,7 @@ this.panelHeight = new Animated.Value(0)

this.emojiHeight = new Animated.Value(0)
this.HeaderHeight = isIphoneX ? iphoneXHeaderPadding + this.iosHeaderHeight : Platform.OS === 'android' ? androidHeaderHeight : this.iosHeaderHeight
this.HeaderHeight = this.isIphoneX ? iphoneXHeaderPadding + this.iosHeaderHeight : Platform.OS === 'android' ? androidHeaderHeight : this.iosHeaderHeight
this.onEndReachedCalledDuringMomentum = true
this.listHeight = height - this.HeaderHeight - 64
this.isInverted = false
this.androidHasAudioPermission = false
this.state = {

@@ -488,3 +490,3 @@ messageContent: '',

_changeMethod () {
async _changeMethod () {
this.setState({ showVoice: !this.state.showVoice })

@@ -502,2 +504,9 @@ this.setState({ saveChangeSize: this.state.inputChangeSize })

}
if (Platform.OS === 'android' && !this.state.showVoice && !this.androidHasAudioPermission) {
const hasPermission = await this.props.checkPermission()
this.androidHasAudioPermission = hasPermission
if (!hasPermission) {
this.props.requestAndroidPermission()
}
}
}

@@ -903,3 +912,3 @@

render () {
const { isIphoneX, messageList, allPanelHeight } = this.props
const { messageList, allPanelHeight } = this.props
const inverted = messageList.hasOwnProperty(this.targetKey) ? messageList[this.targetKey].inverted : false

@@ -921,3 +930,3 @@ const { messageContent, voiceEnd, inputChangeSize, hasPermission, xHeight, keyboardHeight, keyboardShow } = this.state

? height - keyboardHeight - this.HeaderHeight
: height - this.HeaderHeight - allPanelHeight - (isIphoneX ? this.props.iphoneXBottomPadding : 0)
: height - this.HeaderHeight - allPanelHeight - (this.isIphoneX ? this.props.iphoneXBottomPadding : 0)
]

@@ -1001,3 +1010,3 @@ })

ref={e => (this.InputBar = e)}
isIphoneX={isIphoneX}
isIphoneX={this.isIphoneX}
placeholder={this.props.placeholder}

@@ -1038,3 +1047,3 @@ useVoice={this.props.useVoice}

messageSelected={this.state.messageSelected}
isIphoneX={isIphoneX}
isIphoneX={this.isIphoneX}
delPanelButtonStyle={this.props.delPanelButtonStyle}

@@ -1056,3 +1065,3 @@ delPanelStyle={this.props.delPanelStyle}

panelHeight={this.panelHeight}
isIphoneX={isIphoneX}
isIphoneX={this.isIphoneX}
HeaderHeight={this.HeaderHeight}

@@ -1072,3 +1081,3 @@ allPanelHeight={this.props.allPanelHeight}

emojiHeight={this.emojiHeight}
isIphoneX={this.props.isIphoneX}
isIphoneX={this.isIphoneX}
iphoneXBottomPadding={this.props.iphoneXBottomPadding}

@@ -1091,4 +1100,4 @@ HeaderHeight={this.HeaderHeight}

audioPath={this.props.audioPath}
audioHasPermission={this.props.audioHasPermission}
checkAndroidPermission={this.props.checkAndroidPermission}
audioHasPermission={this.androidHasAudioPermission}
audioPermissionState={this.props.audioHasPermission}
voiceSpeakIcon={this.props.voiceSpeakIcon}

@@ -1095,0 +1104,0 @@ audioOnProgress={this.props.audioOnProgress}

import moment from 'moment'
import {Dimensions, Platform} from 'react-native'
import { EMOJIS_ZH, invertKeyValues } from '../source/emojis'
const X_WIDTH = 375
const X_HEIGHT = 812
const XSMAX_WIDTH = 414
const XSMAX_HEIGHT = 896
const PAD_WIDTH = 768
const PAD_HEIGHT = 1024
const IPADPRO11_WIDTH = 834
const IPADPRO11_HEIGHT = 1194
const IPADPRO129_HEIGHT = 1024
const IPADPRO129_WIDTH = 1366
const { height: D_HEIGHT, width: D_WIDTH } = Dimensions.get('window')
const getCurrentTime = (time = 0) => {

@@ -131,5 +144,15 @@ const nowTime = new Date() // 当前日前对象

const isIPhoneX = () => {
return (
(Platform.OS === 'ios' &&
((D_HEIGHT === X_HEIGHT && D_WIDTH === X_WIDTH) ||
(D_HEIGHT === X_WIDTH && D_WIDTH === X_HEIGHT))) ||
((D_HEIGHT === XSMAX_HEIGHT && D_WIDTH === XSMAX_WIDTH) ||
(D_HEIGHT === XSMAX_WIDTH && D_WIDTH === XSMAX_HEIGHT))
)
}
export {
getCurrentTime,
changeEmojiText
changeEmojiText,
isIPhoneX
}

@@ -41,6 +41,7 @@ import React, { PureComponent } from 'react'

componentDidMount () {
this.props.audioInitPath()
this.props.audioOnProgress()
this.props.audioOnFinish()
Platform.OS === 'android' && this.props.checkAndroidPermission()
if (Platform.OS !== 'android') {
this.props.audioInitPath()
this.props.audioOnProgress()
this.props.audioOnFinish()
}
}

@@ -63,3 +64,2 @@

show () {
const { hasPermission } = this.props
this.setState({

@@ -80,3 +80,2 @@ isShow: true

await this._stop()
const { hasPermission } = this.state
let delayTime = 0

@@ -100,3 +99,5 @@ const { audioCurrentTime } = this.props

audioCurrentTime >= 1 && this.props.sendVoice && this.props.sendVoice('voice', content)
this.props.audioInitPath()
if (Platform.OS !== 'android') {
this.props.audioInitPath()
}
}

@@ -161,2 +162,7 @@

this.setState({ recording: true, paused: false })
if (Platform.OS === 'android') {
await this.props.audioInitPath()
await this.props.audioOnProgress()
await this.props.audioOnFinish()
}
try {

@@ -163,0 +169,0 @@ await this.props.audioRecord()

@@ -162,3 +162,2 @@ # react-native-easy-chat-ui

pressAvatar | (isSelf) => {} | 点击头像的回调
isIphoneX | true | 是否是苹果的刘海屏手机
androidHeaderHeight | 66 | android的导航头高度(加上statusBar高度)

@@ -233,3 +232,4 @@ userProfile | {id: '88888888', avatar: 'default.png'} | 你自己的个人资料

audioHasPermission | false | 是否有录音权限
checkAndroidPermission | () => {} | android检查录音权限的回调
requestAndroidPermission | () => {} | android检查录音权限的回调
checkPermission | () => {} | 检查是否已获得录音权限
voiceLoading | false | 是否正在加载语音

@@ -236,0 +236,0 @@ voicePlaying | false | 是否正在播放语音

{
"name": "react-native-easy-chat-ui",
"version": "0.2.5",
"version": "0.2.6",
"description": "chat UI for React Native",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -163,3 +163,2 @@ # react-native-easy-chat-ui

pressAvatar | (isSelf) => {} | Callback when press avatar
isIphoneX | true | Is iphoneX、iphoneXR、iphoneXS or iphoneXS Max?
androidHeaderHeight | 66 | Android navigation bar height + statusBar height

@@ -229,3 +228,4 @@ userProfile | {id: '88888888', avatar: 'default.png'} | Your own profile

audioHasPermission | false | Whether has permission
checkAndroidPermission | () => {} | Callback when check permission on android
requestAndroidPermission | () => {} | Callback when check permission on android
checkPermission | () => {} | Callback whether has permission
voiceLoading | false | Loading voice or not

@@ -232,0 +232,0 @@ voicePlaying | false | Playing voice or not

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc