react-native-keyboard-area icon indicating copy to clipboard operation
react-native-keyboard-area copied to clipboard

_kbRef$current.open is not a function

Open fukemy opened this issue 3 years ago • 1 comments

hi, i want to access open/close method, but got this crash, can u tech me whats wrong here? Thanks


const kbRef = useRef()

const handleChangeKeyboardType = (newKeyboardType) => {
   kbRef.current?.open()
}

<KeyboardSpacer
                    isOpen={true}
                    onChange={(isOpen: boolean, currentHeight: number) => {
                        console.log('onchange', isOpen, currentHeight)
                    }}
                    ref={kbRef}>   

                    <View style={{ backgroundColor: 'red', width: '100%', height: 100 }}/>
                    {/* {renderAccessory()} */}
                </KeyboardSpacer>

fukemy avatar Jul 25 '22 09:07 fukemy

when log the kbRef.current, i got value

test {"_listeners": [{"remove": [Function remove]}, {"remove": [Function remove]}], "_reactInternalInstance": {}, "_reactInternals": {"_debugHookTypes": null, "_debugNeedsRemount": false, "_debugOwner": {"_debugHookTypes": [Array], "_debugNeedsRemount": false, "_debugOwner": [FiberNode], "_debugSource": null, "actualDuration": 0, "actualStartTime": 1658741704518, "alternate": [FiberNode], "child": [FiberNode], "childLanes": 0, "deletions": null, "dependencies": [Object], "elementType": [Function ChatScreen], "flags": 1048576, "index": 0, "key": null, "lanes": 0, "memoizedProps": [Object], "memoizedState": [Object], "mode": 2, "pendingProps": [Object], "ref": null, "return": [FiberNode], "selfBaseDuration": 0, "sibling": null, "stateNode": null, "subtreeFlags": 1048581, "tag": 0, "treeBaseDuration": 129, "type": [Function ChatScreen], "updateQueue": [Object]}, "_debugSource": {"columnNumber": 17, "fileName": "/Users/thehe/Desktop/VedaxLink/screen/chat/ChatScreen.js", "lineNumber": 1894}, "actualDuration": 0, "actualStartTime": 1658741703755, "alternate": {"_debugHookTypes": null, "_debugNeedsRemount": false, "_debugOwner": [FiberNode], "_debugSource": [Object], "actualDuration": 0, "actualStartTime": 1658741704517, "alternate": [Circular], "child": [FiberNode], "childLanes": 0, "deletions": null, "dependencies": null, "elementType": [Function KeyboardSpacer], "flags": 1, "index": 1, "key": null, "lanes": 0, "memoizedProps": [Object], "memoizedState": [Object], "mode": 2, "pendingProps": [Object], "ref": [Object], "return": [FiberNode], "selfBaseDuration": 0, "sibling": null, "stateNode": [Circular], "subtreeFlags": 5, "tag": 1, "treeBaseDuration": 0, "type": [Function KeyboardSpacer], "updateQueue": [Object]}, "child": {"_debugHookTypes": null, "_debugNeedsRemount": false, "_debugOwner": [Circular], "_debugSource": [Object], "actualDuration": 0, "actualStartTime": 1658741703618, "alternate": [FiberNode], "child": [FiberNode], "childLanes": 0, "deletions": null, "dependencies": null, "elementType": [Object], "flags": 1, "index": 0, "key": null, "lanes": 0, "memoizedProps": [Object], "memoizedState": null, "mode": 2, "pendingProps": [Object], "ref": null, "return": [Circular], "selfBaseDuration": 0, "sibling": null, "stateNode": null, "subtreeFlags": 4, "tag": 11, "treeBaseDuration": 0, "type": [Object], "updateQueue": null}, "childLanes": 0, "deletions": null, "dependencies": null, "elementType": [Function KeyboardSpacer], "flags": 0, "index": 1, "key": null, "lanes": 1, "memoizedProps": {"children": <View … />, "isOpen": false, "onChange": [Function onChange], "onToggle": [Function onToggle], "topSpacing": 0}, "memoizedState": {"isKeyboardOpened": true, "keyboardSpace": 291}, "mode": 2, "pendingProps": {"children": <View … />, "isOpen": false, "onChange": [Function onChange], "onToggle": [Function onToggle], "topSpacing": 0}, "ref": {"current": [Circular]}, "return": {"_debugHookTypes": null, "_debugNeedsRemount": false, "_debugOwner": [FiberNode], "_debugSource": [Object], "actualDuration": 0, "actualStartTime": 1658741703750, "alternate": [FiberNode], "child": [FiberNode], "childLanes": 1, "deletions": null, "dependencies": null, "elementType": "RCTView", "flags": 0, "index": 0, "key": null, "lanes": 0, "memoizedProps": [Object], "memoizedState": null, "mode": 2, "pendingProps": [Object], "ref": null, "return": [FiberNode], "selfBaseDuration": 0, "sibling": null, "stateNode": [ReactNativeFiberHostComponent], "subtreeFlags": 1048576, "tag": 5, "treeBaseDuration": 128, "type": "RCTView", "updateQueue": null}, "selfBaseDuration": 0, "sibling": null, "stateNode": [Circular], "subtreeFlags": 0, "tag": 1, "treeBaseDuration": 0, "type": [Function KeyboardSpacer], "updateQueue": {"baseState": [Object], "effects": null, "firstBaseUpdate": [Object], "lastBaseUpdate": [Object], "shared": [Object]}}, "context": {}, "props": {"children": <View style={[Object]} />, "isOpen": false, "onChange": [Function onChange], "onToggle": [Function onToggle], "topSpacing": 0}, "refs": {}, "resetKeyboardSpace": [Function bound resetKeyboardSpace], "state": {"isKeyboardOpened": true, "keyboardSpace": 291}, "updateKeyboardSpace": [Function bound updateKeyboardSpace], "updater": {"enqueueForceUpdate": [Function enqueueForceUpdate], "enqueueReplaceState": [Function enqueueReplaceState], "enqueueSetState": [Function enqueueSetState], "isMounted": [Function isMounted]}}

fukemy avatar Jul 25 '22 09:07 fukemy