Skip to content
Permalink
Browse files

fix header nav on example

  • Loading branch information...
xcarpentier committed Oct 3, 2019
1 parent e8bf883 commit 2a67342ea971879d14daff8220fbcfc0bf6769e6
Showing with 24 additions and 16 deletions.
  1. +13 −12 example-expo/NavBar.js
  2. +11 −4 src/GiftedChat.tsx
@@ -1,6 +1,5 @@
/* eslint jsx-a11y/accessible-emoji: 0 */
import React from 'react'
import { Text, Platform } from 'react-native'
import { Text, Platform, SafeAreaView } from 'react-native'
import NavBar, { NavTitle, NavButton } from 'react-native-nav'
import Constants from 'expo-constants'

@@ -9,15 +8,17 @@ export default function NavBarCustom() {
return null
}
return (
<NavBar>
<NavButton />
<NavTitle>
💬 Gifted Chat{'\n'}
<Text style={{ fontSize: 10, color: '#aaa' }}>
({Constants.expoVersion})
</Text>
</NavTitle>
<NavButton />
</NavBar>
<SafeAreaView style={{ backgroundColor: '#f5f5f5' }}>
<NavBar>
<NavButton />
<NavTitle>
💬 Gifted Chat{'\n'}
<Text style={{ fontSize: 10, color: '#aaa' }}>
({Constants.expoVersion})
</Text>
</NavTitle>
<NavButton />
</NavBar>
</SafeAreaView>
)
}
@@ -402,12 +402,19 @@ class GiftedChat<TMessage extends IMessage = IMessage> extends React.Component<

componentDidUpdate(prevProps: GiftedChatProps<TMessage> = {}) {
const { messages, text } = this.props
if (messages && prevProps.messages) {

if (this.props !== prevProps) {
this.setMessages(messages || [])
if (messages.length !== prevProps.messages.length) {
setTimeout(() => this.scrollToBottom(false), 200)
}
}

if (
messages &&
prevProps.messages &&
messages.length !== prevProps.messages.length
) {
setTimeout(() => this.scrollToBottom(false), 200)
}

if (text !== prevProps.text) {
this.setTextFromProp(text)
}

0 comments on commit 2a67342

Please sign in to comment.
You can’t perform that action at this time.