Skip to content

Keyboard components - add docs #1984

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

Merged
merged 5 commits into from
Apr 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ buck-out/
\.buckd/
*.keystore

lib/
.vscode

# fastlane
Expand Down
1 change: 1 addition & 0 deletions lib/components/Keyboard/KeyboardInput/KeyboardRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export default class KeyboardRegistry {
};

/**
* @deprecated
* iOS only (experimental)
* Call to make the keyboard full screen
* componentID (string) - the ID of the keyboard.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"name": "KeyboardAccessoryView",
"category": "keyboard",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extends: KeyboardTrackingView

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It technically does, but for the user it is not true (all KeyboardTrackingView props are passed literally in the KeyboardAccessoryViewProps and there's no extends \ others used).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right... I'm not sure why thought

"description": "View that allows replacing the default keyboard with other components",
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardInput/KeyboardInputViewScreen.js",
"images": [
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardAccessoryView/KeyboardAccessoryView.gif?raw=true"
],
"props": [
{
"name": "renderContent",
"type": "() => React.ReactElement",
"description": "Content to be rendered above the keyboard"
},
{
"name": "onHeightChanged",
"type": "(height: number) => void",
"description": "A callback for when the height is changed"
},
{
"name": "kbInputRef",
"type": "any",
"description": "The reference to the actual text input (or the keyboard may not reset when instructed to, etc.).\niOS only.",
"required": true
},
{
"name": "kbComponent",
"type": "string",
"description": "The keyboard ID (the componentID sent to KeyboardRegistry)"
},
{"name": "kbInitialProps", "type": "any", "description": "The props that will be sent to the KeyboardComponent"},
{
"name": "onItemSelected",
"type": "() => void",
"description": "Callback that will be called when an item on the keyboard has been pressed."
},
{
"name": "onRequestShowKeyboard",
"type": "() => void",
"description": "Callback that will be called if KeyboardRegistry.requestShowKeyboard is called."
},
{
"name": "onKeyboardResigned",
"type": "() => void",
"description": "Callback that will be called once the keyboard has been closed"
},
{
"name": "iOSScrollBehavior",
"type": "number",
"description": "The scrolling behavior, use KeyboardAccessoryView.iosScrollBehaviors.X where X is:\nNONE, SCROLL_TO_BOTTOM_INVERTED_ONLY or FIXED_OFFSET\niOS only.",
"default": "FIXED_OFFSET"
},
{
"name": "revealKeyboardInteractive",
"type": "boolean",
"description": "Show the keyboard on a negative scroll\niOS only.",
"default": "false"
},
{
"name": "manageScrollView",
"type": "boolean",
"description": "Set to false to turn off inset management and manage it yourself\niOS only.",
"default": "true"
},
{
"name": "requiresSameParentToManageScrollView",
"type": "boolean",
"description": "Set to true manageScrollView is set to true and still does not work,\nit means that the ScrollView found is the wrong one and you'll have\nto have the KeyboardAccessoryView and the ScrollView as siblings\nand set this to true\niOS only.",
"default": "false"
},
{
"name": "addBottomView",
"type": "boolean",
"description": "Add a (white) SafeArea view beneath the KeyboardAccessoryView\niOS only.",
"default": "false"
},
{
"name": "allowHitsOutsideBounds",
"type": "boolean",
"description": "Allow hitting sub-views that are placed beyond the view bounds\niOS only.",
"default": "false"
},
{
"name": "useSafeArea",
"type": "boolean",
"description": "Whether or not to handle SafeArea\niOS only.",
"default": "true"
},
{
"name": "usesBottomTabs",
"type": "boolean",
"description": "Whether or not to include bottom tab bar inset\niOS only.",
"default": "false"
}
],
"snippet": ["KeyboardRegistry.registerKeyboard('keyboardName$1', () => KeyboardComponent$2)"]
}
50 changes: 50 additions & 0 deletions lib/components/Keyboard/KeyboardInput/keyboardRegistry.api.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "KeyboardRegistry",
"category": "keyboard",
"description": "used for registering keyboards and performing certain actions on the keyboards.",
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardInput/demoKeyboards.js",
"props": [
{
"name": "registerKeyboard",
"type": "static function",
"description": "Register a new keyboard.\ncomponentID (string) - the ID of the keyboard.\ngenerator (function) - a function for the creation of the keyboard.\nparams (object) - to be returned when using other methods (i.e. getKeyboards and getAllKeyboards)."
},
{
"name": "getKeyboard",
"type": "static function",
"description": "Get a specific keyboard\ncomponentID (string) - the ID of the keyboard."
},
{
"name": "getKeyboards",
"type": "static function",
"description": "Get keyboards by IDs\ncomponentIDs (string[]) - the ID of the keyboard."
},
{"name": "getAllKeyboards", "type": "static function", "description": "Get all keyboards"},
{
"name": "addListener",
"type": "static function",
"description": "Add a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n (i.e. if componentID='kb1' globalID='kb1.onItemSelected')\ncallback (function) - the callback to be called when the said event happens"
},
{
"name": "notifyListeners",
"type": "static function",
"description": "Notify that an event has occurred.\nglobalID (string) - ID that includes the componentID and the event name\n (i.e. if componentID='kb1' globalID='kb1.onItemSelected')\nargs (object) - data to be sent to the listener."
},
{
"name": "removeListeners",
"type": "static function",
"description": "Remove a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n (i.e. if componentID='kb1' globalID='kb1.onItemSelected')"
},
{
"name": "onItemSelected",
"type": "static function",
"description": "Default event to be used for when an item on the keyboard has been pressed.\ncomponentID (string) - the ID of the keyboard.\nargs (object) - data to be sent to the listener."
},
{
"name": "requestShowKeyboard",
"type": "static function",
"description": "Request to show the keyboard\ncomponentID (string) - the ID of the keyboard."
}
],
"snippet": ["KeyboardRegistry.registerKeyboard('keyboardName$1', () => KeyboardComponent$2)"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "KeyboardTrackingView",
"category": "keyboard",
"description": "A UI component that enables 'keyboard tracking' for this view and it's sub-views.\nWould typically be used when you have a TextField or TextInput inside this view.",
"notes": "This view is useful only for iOS.",
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js",
"images": [
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardTrackingView/KeyboardTrackingView.gif?raw=true"
],
"props": [
{
"name": "trackInteractive",
"type": "boolean",
"description": "Enables tracking of the keyboard when it's dismissed interactively (false by default).\nWhy? When using an external keyboard (BT),\nyou still get the keyboard events and the view just hovers when you focus the input.\nAlso, if you're not using interactive style of dismissing the keyboard\n(or if you don't have an input inside this view) it doesn't make sense to track it anyway.\n(This is caused because of the usage of inputAccessory to be able to track the keyboard interactive change and it introduces this bug)"
},
{"name": "useSafeArea", "type": "boolean", "description": "Allow control safe area"},
{"name": "usesBottomTabs", "type": "boolean", "description": "Whether or not to include bottom tab bar inset"},
{"name": "scrollToFocusedInput", "type": "boolean", "description": ""},
{"name": "scrollBehavior", "type": "number", "description": ""},
{"name": "revealKeyboardInteractive", "type": "boolean", "description": ""},
{"name": "manageScrollView", "type": "", "description": "boolean"},
{"name": "requiresSameParentToManageScrollView", "type": "", "description": "boolean"},
{"name": "addBottomView", "type": "", "description": "boolean"},
{"name": "allowHitsOutsideBounds", "type": "", "description": "boolean"},
{"name": "ref", "type": "any", "description": ""},
{"name": "style", "type": "ViewStyle", "description": ""}
],
"snippet": [
"<KeyboardTrackingView",
"style={$1}",
"trackInteractive",
"useSafeArea",
">",
"%2",
"</KeyboardTrackingView>"
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "KeyboardAwareInsetsView",
"category": "keyboard",
"description": "Used to add an inset when a keyboard is used and might hide part of the screen.",
"notes": "This view is useful only for iOS.",
"extends": "KeyboardTrackingView",
"extendsLink": [
"https://github.com/wix/react-native-ui-lib/blob/master/lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.tsx"
],
"snippet": ["<KeyboardAwareInsetsView/>"]
}
2 changes: 1 addition & 1 deletion src/components/gridListItem/gridListItem.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "renderCustomItem",
"type": "() => React.ReactElement",
"description": "Custom GridListItem to be rendered in the GridView",
"required": ""
"required": true
},
{"name": "itemSize", "type": "number | ImageSize", "description": "The item size"},
{"name": "title", "type": "string | React.ReactElement", "description": "Title content text"},
Expand Down