-
Notifications
You must be signed in to change notification settings - Fork 382
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
Feat RN KeyboardAvoidingView #1857
Conversation
…delete when the initial value of the input exceeds maxLength
@@ -0,0 +1,83 @@ | |||
import React, { ReactNode, useContext, useEffect } from 'react' | |||
import { EmitterSubscription, Keyboard, Platform, View, ViewStyle } from 'react-native' | |||
import Animted, { useSharedValue, useAnimatedStyle, withTiming } from 'react-native-reanimated' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Animated
cursorSpacing: 0, | ||
ref: null | ||
}) | ||
bottom.value = withTiming(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
动画曲线得配置一下
} else { | ||
subscriptions = [ | ||
Keyboard.addListener('keyboardDidShow', (evt: any) => { | ||
if (!keyboardAvoid) return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ios和安卓这块的区别是啥,除了事件名不同
if (adjustPosition && keyboardAvoid) { | ||
Object.assign(keyboardAvoid, { | ||
cursorSpacing, | ||
ref: nodeRef.current |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个ref直接透传nodeRef好一点吧,这样可能能规避一些边界条件
const animatedStyle = useAnimatedStyle(() => ({ transform: [{ translateY: -bottom.value }] })) | ||
|
||
const resetKeyboard = () => { | ||
keyboardAvoid && Object.assign(keyboardAvoid, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object.assign替换为utils中的extendObject
@@ -37,9 +37,8 @@ | |||
* ✘ bind:keyboardcompositionend | |||
* ✘ bind:onkeyboardheightchange | |||
*/ | |||
import { JSX, forwardRef, useMemo, useRef, useState, useContext, useEffect, createElement } from 'react' | |||
import { JSX, forwardRef, useRef, useState, useContext, useEffect, createElement } from 'react' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
textarea也需要支持adjust-position
No description provided.