When nesting my application within the <KeyboardShift />
, it fails to render.
There's a couple of reasons why this could be:
- The entire dependency stack for this library (including a duplicate version of React) is included. Many of these could be moved to
devDependencies
/peerDependencies
, with an explicit statement that the library depends upon @react-navigation/elements
.
- This line which depends on conditional hook execution.
I was able to resolve the issue locally by installing @react-navigation/elements
to my root project and deleting the local node_modules
directory installed at node_modules/\@fullstackcraft/
.
The package.json
could look something like:
{
"name": "@fullstackcraft/react-native-keyboard-shift",
"version": "1.1.4",
"description": "A 2020s compatible keyboard avoiding view for Android and iOS that just works.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"test": "jest --config jestconfig.json",
"build": "tsc",
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.tsx\"",
"lint": "tslint -p tsconfig.json",
"prepare": "npm run build",
"prepublishOnly": "npm test && npm run lint",
"preversion": "npm run lint",
"version": "npm run format && git add -A src",
"postversion": "git push && git push --tags"
},
"dependencies": {
"@react-native-community/hooks": "^2.6.0",
- "@react-navigation/elements": "^1.1.2",
+ "@react-navigation/elements": "^1.1.2"
- "react": ">= 17.0.2",
- "react-native": ">=0.64.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/FullStackCraft/react-native-keyboard-shift.git"
},
"keywords": [
"react",
"native",
"keyboard",
"keyboardshift",
"keyboard",
"shift",
"android",
"ios"
],
"author": "Chris Frewin",
"license": "MIT",
"bugs": {
"url": "https://github.com/FullStackCraft/react-native-keyboard-shift/issues"
},
"homepage": "https://github.com/FullStackCraft/react-native-keyboard-shift#readme",
"devDependencies": {
"@types/jest": "^27.0.2",
"@types/node": "^16.10.2",
"@types/react": "^17.0.26",
"@types/react-native": "^0.65.3",
"jest": "^27.2.4",
"prettier": "^2.4.1",
+ "react": ">= 17.0.2",
+ "react-native": ">=0.64.0",
"ts-jest": "^27.0.5",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
},
"files": [
"lib/**/*"
]
}