Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize rendering and keyboard smoothness #2493

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6b3dac9
example: upd deps
kesha-antonov Apr 5, 2024
d8effdf
optimize keyboard smoothness & rendering many components
kesha-antonov Apr 5, 2024
7a98b0e
example: nav - add padding top
kesha-antonov Apr 5, 2024
b5cb723
add react-native-safe-area-context to peer deps
kesha-antonov Apr 5, 2024
43625da
optimize: prevent excessive re-renders on typing and keyboard show
kesha-antonov Apr 6, 2024
436ea53
bump v
kesha-antonov Apr 11, 2024
87393fc
package.json: add files - include src, lib
kesha-antonov May 16, 2024
d060916
more optimizations
kesha-antonov Jul 12, 2024
8f2443c
workflow: bump node v to latest stable
kesha-antonov Aug 19, 2024
a265943
Merge branch 'master' into optimize_rendering_and_keyboard_smoothness…
kesha-antonov Aug 19, 2024
31d1020
example: upd deps
kesha-antonov Aug 19, 2024
630ab82
package.json: set yarn v
kesha-antonov Aug 19, 2024
32d7488
replace expo-clipboard with @react-native-clipboard/clipboard to rely…
kesha-antonov Aug 19, 2024
9a76a50
fix all lint problems
kesha-antonov Aug 19, 2024
c7a4575
Merge branch 'master' into optimize_rendering_and_keyboard_smoothness…
kesha-antonov Aug 19, 2024
a0408ae
ts fixes
kesha-antonov Aug 19, 2024
8c41021
fix husky hook
kesha-antonov Aug 19, 2024
6921592
setup eslint correctly. add @stylistic. remove prettier. upd RN to la…
kesha-antonov Aug 20, 2024
9d457f1
eslint: detect unreachable code
kesha-antonov Aug 20, 2024
1fbc5a3
upd deps
kesha-antonov Aug 20, 2024
da6932d
example: fixed - now it works
kesha-antonov Aug 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

example/*
/lib
129 changes: 129 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
module.exports = {
env: {
es2021: true,
// jest: true,
browser: true,
node: true,
// 'jest/globals': true,
},
parser: '@typescript-eslint/parser',
extends: [
'standard',
'eslint:recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
"plugin:@typescript-eslint/eslint-recommended",
'plugin:@typescript-eslint/recommended',
'plugin:json/recommended-legacy',
'plugin:jest/recommended',
],
overrides: [
{
env: {
node: true,
},
files: ['.eslintrc.{js,cjs}'],
parserOptions: {
sourceType: 'script',
project: './tsconfig.json',
},
},
// {
// files: ['*.snap'],
// processor: 'jest/.snap',
// },
],
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: [
'@stylistic',
'react',
'react-hooks',
],
settings: {
react: {
version: 'detect',
},
},
rules: {
'react/react-in-jsx-scope': 0,
'@stylistic/no-explicit-any': 'off',
'react/no-unknown-property': 0,
'indent': [
'error',
2,
{
SwitchCase: 1,
VariableDeclarator: 'first',
ignoredNodes: ['TemplateLiteral'],
},
],
'template-curly-spacing': 'off',
'linebreak-style': ['off', 'unix'],
'quotes': ['error', 'single'],
'jsx-quotes': ['error', 'prefer-single'],
'@stylistic/semi': ['error', 'never'],
'@stylistic/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'none', // No semicolon for multiline
requireLast: true,
},
singleline: {
delimiter: 'comma', // Use comma for single line
requireLast: false,
},
},
],
'comma-dangle': [
'error',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'always-multiline',
exports: 'never',
functions: 'never',
},
],
'arrow-parens': ['error', 'as-needed'],
'no-func-assign': 'off',
'no-class-assign': 'off',
'no-useless-escape': 'off',
'curly': [2, 'multi', 'consistent'],
'react/prop-types': 'off', // TODO: TURN ON AND FIX ALL WARNINGS
'react/display-name': 'off',
'react-hooks/exhaustive-deps': [
'warn',
{
additionalHooks:
'(useAnimatedStyle|useSharedValue|useAnimatedGestureHandler|useAnimatedScrollHandler|useAnimatedProps|useDerivedValue|useAnimatedRef|useAnimatedReact|useAnimatedReaction)',
// useAnimatedReaction
// USE RULE FUNC/FUNC/DEPS
},
],
'no-unused-vars': ['error'],
'brace-style': ['error', '1tbs', { allowSingleLine: false }],
'nonblock-statement-body-position': ['error', 'below'],
'@stylistic/jsx-closing-bracket-location': ['error', 'line-aligned'],
'no-unreachable': 'error',
},
globals: {
describe: 'readonly',
test: 'readonly',
jest: 'readonly',
expect: 'readonly',
fetch: 'readonly',
navigator: 'readonly',
__DEV__: 'readonly',
XMLHttpRequest: 'readonly',
FormData: 'readonly',
React$Element: 'readonly',
requestAnimationFrame: 'readonly',
},
}
21 changes: 0 additions & 21 deletions .eslintrc.js

This file was deleted.

11 changes: 0 additions & 11 deletions .flowconfig

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ Exponent-*.app
lib/
coverage/
web-build/
.eslintcache
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn lint-staged
1 change: 0 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
.expo-shared/
.circleci/
.github/
.prettierrc
.vscode/
example-expo/
example-slack-message/
Expand Down
12 changes: 0 additions & 12 deletions .prettierrc

This file was deleted.

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ See PR [#1211](https://github.com/FaridSafi/react-native-gifted-chat/pull/1211)
interface Reply {
title: string
value: string
messageId?: any
messageId?: number | string
}

interface QuickReplies {
Expand Down Expand Up @@ -346,7 +346,6 @@ interface QuickReplies {
- **`timeFormat`** _(String)_ - Format to use for rendering times; default is `'LT'` (see [Day.js Format](https://day.js.org/docs/en/display/format))
- **`dateFormat`** _(String)_ - Format to use for rendering dates; default is `'ll'` (see [Day.js Format](https://day.js.org/docs/en/display/format))
- **`loadEarlier`** _(Bool)_ - Enables the "load earlier messages" button, required for `infiniteScroll`
- **`isKeyboardInternallyHandled`** _(Bool)_ - Determine whether to handle keyboard awareness inside the plugin. If you have your own keyboard handling outside the plugin set this to false; default is `true`
- **`onLoadEarlier`** _(Function)_ - Callback when loading earlier messages
- **`isLoadingEarlier`** _(Bool)_ - Display an `ActivityIndicator` when loading earlier messages
- **`renderLoading`** _(Function)_ - Render a loading view when initializing
Expand Down Expand Up @@ -385,7 +384,6 @@ interface QuickReplies {
- **`renderSend`** _(Function)_ - Custom send button; you can pass children to the original `Send` component quite easily, for example, to use a custom icon ([example](https://github.com/FaridSafi/react-native-gifted-chat/pull/487))
- **`renderAccessory`** _(Function)_ - Custom second line of actions below the message composer
- **`onPressActionButton`** _(Function)_ - Callback when the Action button is pressed (if set, the default `actionSheet` will not be used)
- **`bottomOffset`** _(Integer)_ - Distance of the chat from the bottom of the screen (e.g. useful if you display a tab bar)
- **`minInputToolbarHeight`** _(Integer)_ - Minimum height of the input toolbar; default is `44`
- **`listViewProps`** _(Object)_ - Extra props to be passed to the messages [`<ListView>`](https://facebook.github.io/react-native/docs/listview.html); some props can't be overridden, see the code in `MessageContainer.render()` for details
- **`textInputProps`** _(Object)_ - Extra props to be passed to the [`<TextInput>`](https://facebook.github.io/react-native/docs/textinput.html)
Expand Down
6 changes: 6 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ web-build/

# macOS
.DS_Store

ios/.xcode.env.local
*.hprof
.cxx/

/vendor/bundle/
Loading
Loading