Skip to content

Commit

Permalink
chore(publishing): 🔧 fixed linting and testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan-dutoit committed Apr 10, 2022
1 parent 09952a0 commit a010060
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 23 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-gifted-chat",
"version": "0.16.3",
"version": "1.0.0-beta-1",
"description": "The most complete chat UI for React Native",
"main": "node_modules/expo/AppEntry.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -80,6 +80,7 @@
"babel-jest": "25.5.1",
"babel-preset-expo": "8.3.0",
"expo": "^41.0.0",
"expo-app-loading": "1.0.3",
"expo-constants": "~10.1.3",
"expo-image-picker": "~10.1.4",
"expo-location": "~12.0.4",
Expand All @@ -104,7 +105,6 @@
"dependencies": {
"@expo/react-native-action-sheet": "^3.6.0",
"dayjs": "^1.8.26",
"expo-app-loading": "^1.0.3",
"prop-types": "^15.7.2",
"react-native-communications": "^2.2.1",
"react-native-iphone-x-helper": "^1.3.1",
Expand Down
2 changes: 1 addition & 1 deletion src/Bubble.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ export default class Bubble<
<TouchableWithoutFeedback
onPress={this.onPress}
onLongPress={this.onLongPress}
accessibilityTraits='text'
accessibilityRole='text'
{...this.props.touchableProps}
>
<View>
Expand Down
6 changes: 3 additions & 3 deletions src/GiftedAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default class GiftedAvatar extends React.Component<GiftedAvatarProps> {
styles.avatarTransparent,
this.props.avatarStyle,
]}
accessibilityTraits='image'
accessibilityRole='image'
/>
)
}
Expand All @@ -169,7 +169,7 @@ export default class GiftedAvatar extends React.Component<GiftedAvatarProps> {
disabled={!this.props.onPress}
onPress={this.props.onPress}
onLongPress={this.props.onLongPress}
accessibilityTraits='image'
accessibilityRole='image'
>
{this.renderAvatar()}
</TouchableOpacity>
Expand All @@ -188,7 +188,7 @@ export default class GiftedAvatar extends React.Component<GiftedAvatarProps> {
{ backgroundColor: this.avatarColor },
this.props.avatarStyle,
]}
accessibilityTraits='image'
accessibilityRole='image'
>
{this.renderInitials()}
</TouchableOpacity>
Expand Down
9 changes: 4 additions & 5 deletions src/InputToolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,14 @@ export function InputToolbar<TMessage extends IMessage = IMessage>(
'keyboardWillShow',
() => setPosition('relative'),
)
return () => keyboardWillShowListener?.remove()
}, [])

useEffect(() => {
const keyboardWillHideListener = Keyboard.addListener(
'keyboardWillHide',
() => setPosition('absolute'),
)
return () => keyboardWillHideListener?.remove()
return () => {
keyboardWillShowListener?.remove()
keyboardWillHideListener?.remove()
}
}, [])

const { containerStyle, ...rest } = props
Expand Down
2 changes: 1 addition & 1 deletion src/LoadEarlier.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function LoadEarlier(props: LoadEarlierProps): React.ReactElement {
style={[styles.container, props.containerStyle]}
onPress={onLoadEarlier}
disabled={isLoadingEarlier}
accessibilityTraits='button'
accessibilityRole='button'
>
<View style={[styles.wrapper, props.wrapperStyle]}>
{isLoadingEarlier ? (
Expand Down
2 changes: 1 addition & 1 deletion src/MessageText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export const MessageText = <TMessage extends IMessage = IMessage>({
// When someone sends a message that includes a website address beginning with "www." (omitting the scheme),
// react-native-parsed-text recognizes it as a valid url, but Linking fails to open due to the missing scheme.
if (WWW_URL_PATTERN.test(url)) {
onUrlPress(`http://${url}`)
onUrlPress(`https://${url}`)
} else {
Linking.canOpenURL(url).then(supported => {
if (!supported) {
Expand Down
2 changes: 1 addition & 1 deletion src/Send.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const Send = <TMessage extends IMessage = IMessage>({
accessibilityLabel='send'
style={[styles.container, containerStyle]}
onPress={handleOnPress}
accessibilityTraits='button'
accessibilityRole='button'
disabled={disabled}
{...sendButtonProps}
>
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/__snapshots__/Bubble.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ exports[`should render <Bubble /> and compare with snapshot 1`] = `
}
>
<View
accessibilityRole="text"
accessible={true}
focusable={true}
onClick={[Function]}
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/GiftedAvatar.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`should render <GiftedAvatar /> and compare with snapshot 1`] = `
<View
accessibilityTraits="image"
accessibilityRole="image"
style={
Array [
Object {
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/__snapshots__/LoadEarlier.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`should render <LoadEarlier /> and compare with snapshot 1`] = `
<View
accessibilityRole="button"
accessible={true}
focusable={true}
onClick={[Function]}
Expand Down
5 changes: 4 additions & 1 deletion src/__tests__/__snapshots__/Message.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ exports[`Message component should render <Message /> and compare with snapshot 1
}
>
<View
accessibilityRole="text"
accessible={true}
focusable={true}
onClick={[Function]}
Expand Down Expand Up @@ -256,7 +257,7 @@ exports[`Message component should render <Message /> with Avatar 1`] = `
}
>
<View
accessibilityTraits="image"
accessibilityRole="image"
style={
Array [
Object {
Expand Down Expand Up @@ -309,6 +310,7 @@ exports[`Message component should render <Message /> with Avatar 1`] = `
}
>
<View
accessibilityRole="text"
accessible={true}
focusable={true}
onClick={[Function]}
Expand Down Expand Up @@ -498,6 +500,7 @@ exports[`Message component should render null if user has no Avatar 1`] = `
}
>
<View
accessibilityRole="text"
accessible={true}
focusable={true}
onClick={[Function]}
Expand Down
6 changes: 3 additions & 3 deletions src/hooks/useUpdateLayoutEffect.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useLayoutEffect, useRef } from 'react'
import { DependencyList, useLayoutEffect, useRef } from 'react'

/**
* A custom useEffect hook that only triggers on updates, not on initial mount
* Idea stolen from: https://stackoverflow.com/a/55075818/1526448
* @param {()=>void} effect the function to call
* @param {Array<any>} dependencies the state(s) that fires the update
* @param {DependencyList} dependencies the state(s) that fires the update
*/
export function useUpdateLayoutEffect(
effect: () => void,
dependencies: any[] = [],
dependencies: DependencyList = [],
) {
const isInitialMount = useRef(true)

Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4312,7 +4312,7 @@ expect@^25.5.0:
jest-message-util "^25.5.0"
jest-regex-util "^25.2.6"

expo-app-loading@^1.0.3:
[email protected]:
version "1.0.3"
resolved "https://registry.yarnpkg.com/expo-app-loading/-/expo-app-loading-1.0.3.tgz#35c2dfd71aacd9f5c53777e3ff2ac07549e766df"
integrity sha512-zLheUgBCQoyybJrGxw81MWfxvlnHb7zatjLbmkNosqMwqq3MOPC/P4HwF6qYsrVUFO6PIzb4yq3lFO3RkCCfhw==
Expand Down Expand Up @@ -4392,9 +4392,9 @@ expo-permissions@~12.0.1:
integrity sha512-TtypNPPLG4SdVEKBlrArLLZIyhlhE+3B4dhz2HaY1Mve2rcvKE0C7z/e1WoUVU8+LgcdKoNGwg/wRVeCkxeEhg==

expo-splash-screen@~0.10.2:
version "0.10.2"
resolved "https://registry.yarnpkg.com/expo-splash-screen/-/expo-splash-screen-0.10.2.tgz#3e3d7c24c4ed180a60ce3ec64a77eefd04dd0d97"
integrity sha512-ngelW7g5yFqk3LWbyLDDxi3LYXEfgGFCJddL/Q8S/C1pMUc5foW2j9i/q+akK8i5mjYtSx3+Bk/qbyX92QIF/w==
version "0.10.3"
resolved "https://registry.yarnpkg.com/expo-splash-screen/-/expo-splash-screen-0.10.3.tgz#a4fae07fc0e0c9e997d88c1174ebaa66d02c370c"
integrity sha512-/9YPJodKjA5/Lq/YZf2aOeIaEjwkd5UW+7mr01CwvMJnZaNCIpt7d0xglxkdhCDQooQFihI/UrUoSDRDegmyjA==
dependencies:
"@expo/configure-splash-screen" "0.3.4"

Expand Down

0 comments on commit a010060

Please sign in to comment.