15 KiB
TODO
Unsorted/Misc
-
Implement:
ContextMenu— Add support forUIDefferedElement. -
Refactor: Use structs instead of classes for holding configuration for making the menu items.`
-
Cleanup: Remove print logs.
- Refactor: Update logic for handling images.
- Copy over
RNIImageItemimpl. fromreact-native-ios-navigator. - Rename
IconConfigtype toIconConfigDeprecated. - Make the
iconproperty accept bothIconConfigDeprecatedandImageItemConfig. - Then in native, map
IconConfigDeprecatedtoImageItemConfig. - Then use
RNIImageItemto create the icon images for the context menu.
- Copy over
- Refactor: Refactor to use typescript + add type annotations.
- Refactor: Refactor example to use typescript.
-
Docs: Update documentation sections
-
Remove numbered subsections.
-
Move links to files out of the section title.
-
Temporarily strip out links to section (i.e. replace with
PLACEHOLDER_LINK). -
Add versions table.
-
Remove collapsable sections.
-
- Sync: Import the core libraries in
react-native-ios-context-menu.- Import
RNIImageItemand updateRCTMenuIconto use it.
- Import
- Implement: Add support for targeted previews on text (i.e. similar to safari).
- Implement: Control
ContextMenuViewvia context and createuseContextMenuViewContexthook. - Implement: Subscribe to
ContextMenuViewevents via event emitter from context. - Implement: Implement
ContextMenuViewevent hook (i.e.useContextMenuViewEventshook).
- Read apple documentation to find any new changes added.
For Next Major Version
- Cleanup: Breaking Change — Remove legacy support for icon config shorthand/shortcut that was added temporarily when migrating between an older version of this library.
Completed
Version: next
- Bugfix: Fix memory leak
- (Commit:
6ddabae) Partially fix memory leak by performing cleanup during reload + when the view is unmounted. - (Commit:
19533b2) UseRNIWrapperViewfor the menu preview. - (Commit:
c45c576) Fix menu preview memory leak,
- (Commit:
-
(Commit:
4c75563) Bugfix: Fix menu action subtitles no longer working on iOS 15.- Example #13 — Setting
discoverabilityTitleno longer does anything.
- In iOS 13, this used to show a subtitle blurb below the menu item title. In iOS 15, it no longer displays the subtitle.
- In iOS 15, there's a new property added called
UIMenuElement.subtitle.
- Example #13 — Setting
- Refactor: Update to use
RNIImageItemfor the menu icons.- (Commit:
836f0a3) Copy overRNIImageItemimpl. fromreact-native-ios-navigator. - (Commit:
97fa40c) Refactor to useRNIImageItemfor menu item icon. - (Commit:
e02d96e) Copy overImageItemConfigtypes fromreact-native-ios-navigator. - (Commit:
e176438) Update types for menu config to acceptImageItemConfig.
- (Commit:
Version: 1.4.0
- (Commit:
a0b008c) Migrate project to use the new template generated bycreate-react-native-libraryandreact-native-builder-bob.- Example app no longer builds, but the library still works when installed on a newly created react-native app. The example project may be incompatible with Xcode 13.1.
- After migrating the project to the new template, the example app now builds + run on iOS 15.
- (Commit:
d1c8277) Sync: UpdateUIColor+Helpers.swiftto use the newer code inreact-native-ios-context-menu. - (Commit:
59d4faf) Refactor: MigrateExtension+Init-related types to use failable initializers instead of static functions. - (Commit:
7bb8148) Cleanup: UpdateMARKcomments in native code. - (Commit:
873b61a) Cleanup: Cleanup swift types (e.g.NSString->String). - (Commit:
ebfa1cc) Cleanup: RemoveRCTSwiftLog+ usage. - (Commit:
3702dfc) Refactor: ReplaceRCTprefix withRNI. - (Commit:
2102840) Refactor: ExtractRNIContextMenuViewnative component to its own separate file. - (Commit:
3fb4faa) Refactor: ExtractRNIContextMenuButtonnative component to its own separate file. - (Commit:
023f8e7) Implement: Types — Add type declaration forMenuConfigand related types. - (Commit:
6768b32) Implement: Types — Add type declaration forMenuPreviewConfigand related types. - (Commit:
01089f0) Implement: Types — Add type declaration forIconConfigand related types. - (Commit:
0d71080) Refactor: Extract constants (e.g.isContextMenuButtonSupported,isContextMenuViewSupported) to their own separate file.
- Implement: Types — Add type declaration for
ContextMenuView- (Commit:
8c72054) Implement: Types — MigrateContextMenuViewcomponent to use typescript and partially added type declarations. - (Commit:
348d2f9) Implement: Types — Add type declaration forContextMenuViewevents.
- (Commit:
- (Commit:
e0bc64f) Implement: Types — Add type declaration forContextMenuButton - (Commit:
25bf0b2) Implement: Types — Partially add type declaration forActionSheetFallback - (Commit:
47a97bc) Implement: Types — Add type declaration forHelpers
Archived/Abandoned
- Docs: In the
MenuActionObject section, add example object with comments. - Docs: In the
MenuConfigObject section, add example object with comments. - Docs: Create collapsable "Table of Contents"
- Docs: Add
README.mdin example directory
ContextMenuButton: AddSystemImagecomponent for creating aUIImagethat uses SF Icons (Research first if the built-in image component already supports this).ContextMenuButton: Add example forwrapNativeComponentprop, i.e. example for using a different "button" component.
ContextMenuView: Custom Preview - Add support for setting an image as the custom preview. Use the built-inImagereact native component to handle setting the image source + sizing. Receive the image as a child fromRCTContextMenuViewand cast it toRCTImageif necessary. The image will then be wrapped inside a view controller and is set as theUIMenu's preview target. The view should be resized to fit the screen.
- Test:
ContextMenuViewandContextMenuButtonon different react native versions- Test on 0.60
- Test on 0.61
- Test on 0.62
- Test on 0.63.3
- Test on 0.63.4
- Test:
react-native-context-menuuses autolinking for installation. Check if this library will work on older react-native versions prior to 0.60 i.e testContextMenuViewandContextMenuButtonon react native versions older than 0.60- Test on 0.59
- Test on 0.58
- Submit a PR to the RN repo — Update RN template to fix
Undefined Symbol - Update
PreviewConfig.previewSizeto support passing in a size object, e.g.{width: 100, height: 100} - Docs: Fix grammar/spelling errors
- Docs: Test/Fix jump links
- Attach RN touch handler to context menu
- Impl. support for icon weight
-
Implement:
ActionSheetModuleto display an "Action Sheet" menu viaUIAlertController.-
Reference: Article in the apple developer about "Alerts and Action Sheets"
-
Reference: 
ActionSheetIOS JS code. The native module is calledRCTActionSheetManager(link to JS native module, and link to native code) -
Reference: @react-native-menu/menu library has a very good looking
ActionSheetfallback with icons and disabled menu actions.
-
-
ContextMenu: Add support forUIDefferedElement-
In
MenuConfig.menuItemsproperty or in themenuConfigprop, if an object has a property calleddefferedKey, then it means we want to create aUIDefferedElementelement. -
Impl.
onRequestDefferedElementfunction. This function is called whenever aUIDefferedElementitem needs to be loaded.- This function will receive a
defferedKey. This function must return a promise, i.e. either aMenuConfigorMenuActionobject. - If the returned promise is a
MenuActionobject, it will usedefferedKeyfor theactionKeyproperty. - In this function, based on the
defferedKeyit must return a correspondingMenuConfig/MenuActionobject. Ifnullis returned, then it means it failed. - This function is invoked from the native side. Native UI component
NativeCommandsdon't natively support promises, so a workaround must be used based onrequestcallbacks (like the one i used on react-native-ios-modal). ButNativeModulefunctions has support for promises built in.- We can use
findNodeHandle(this.nativeCompRef)to get a node handle. Then we can useself.bridge.uiManager.view(forReactTag: node)to get a ref to the component. Then we cast it to the correct type:component as? RCTContextMenuViewand then call the completion function for the correspondingUIDefferedElement, something like:contextMenuView.resolveDefferedMenuElement(for: defferedKey, item: menuElementDict)
- We can use
- We need to create a class to create a
UIDeferredMenuElement. It will extendRNIMenuElementand can be init from a dictionary. Probably name it something like:RCTMenuDefferedItem. It will have one property:defferedKeyRNIMenuItem.createMenufunction must be updated to also handle creating aRCTMenuDefferedItemitem.
- On the native side when we create a
UIDeferredMenuElementwe do this:UIDeferredMenuElement { completion in self.completionDict[defferedKey] = completion }, and then invoke a RN event:self.onRequestDefferedElement([defferedKey: defferedKey]).onRequestDefferedElementevent prop will be invoked. We wait for the promise to return some value and then call aNativeModulefunction.- The
NativeModulefunction will probably look like this:ContextMenuViewModule.resolveDefferedMenuElement({nodeHandle, defferedKey, menuItem}); - Completion handlers will be stored in a dictionary. I'm not sure if I can use
NSMapTable. I can use a plainNSDictionarybut if I accidentally forget to cleanup (i.e. remove the completion handler from the dict) then that completion handler will be retained, causing a memory leak.- Completion handlers, i.e. closures, are reference types. If I assign it to
NSMapTablewithvalueOptions: .weakMemory, will it be automatically be released when it's no longer used? Will it be retained while it's in use or will it be released the moment i add it toNSMapTablebecause nothing is using it? Technically, it is in use because it's inUIDeferredMenuElementargument (so the ref count should increase?)
- Completion handlers, i.e. closures, are reference types. If I assign it to
- This function will receive a
-
Completed Archive
- Docs: First remove all the links that point to the examples directory or links to different section. Highlight them in yellow then replace the highlighted text in the documentation with the new/updated section/examples links.
- Move
ContextMenuViewexamples + tests inexamples/srctoexamples/src/ContextMenuViewthen update documentation links - In the "Examples" section add section for
ContextMenuViewandContextMenuButton, then update the documentation "jump to" heading links - Update and rename Images/Gifs
- Move gifs for
ContextMenuViewin/assetstoassets/ContextMenuView/ - Rename
ContextMenuViewgifs i.e. prefix them with "ContextMenuView" e.g.SimpleExample-1-2-3-4.gifbecomesContextMenuView-SimpleExample-1-2-3-4.gif, etc. - In the
/assets/example-screenshotsfolder, prefix images with "ContextMenuView", e.g.SimpleExample01.pngbecomesContextMenuView-SimpleExample01.png, etc.
- Move gifs for
- Move
- Docs: Add images to steps: Undefined Symbol
- Docs: Make sections collapsabe
- Docs: Fix table layout
- In the "Documentation" section, add
ContextMenuButtonprops. - Finish
onPressMenuItemnativeEventObject section. - Add section for
useActionSheetFallbackprop.
-
ContextMenuView: ExportActionSheetFallbackfunction and add it to the docs. -
ContextMenuView: RenameRCTContextMenuManagertoRCTContextMenuViewManagerand update corresponding js native component -
ContextMenuView: Impl. iOS 14 specific feature:UpdateVisibleMenu -
ContextMenuView: Impl. iOS 14 specific feature:dismissMenu- Try implementing this via
NativeModule
- Try implementing this via
-
ContextMenuView: Custom Preview - Add support for custom previews, i.e by passing a child component toRCTContextMenuView, and wrapping that child inside a view controller and passing it as the preview target inUIMenuconfig. The first child of theRCTContextMenuViewwill be reserved for the custom menu preview. If no child is passed, i.e no custom preview is configured, then the preview target is not set for theUIMenu. The preview view should only be mounted when the menu is visible, and thus, it should support setting the preferred size of the preview target. Test if the preview target can be changed when it's already visible.
ContextMenuButton: Finish initial impl. with 1 working simple exampleContextMenuButton: Add documentation forContextMenuButton
- General: Implement targeted previews
- General: Implement tinted/colored menu icons + config for line weight etc.
- Refactor: Change "ImageType" to "IconType", and "imageValue" to "imageType"
- General: Move menu icon related properties to "icon":
{ icon: { iconType: '', iconValue: '', tint: ''} } ContextMenu— AdddiscoverabilityTitletoUIAction
- Implement
ImageType.ASSETto support: "create an image from an image asset or image file located in your app’s main bundle"- The
imageValuestring fromMenuAction/MenuConfigwill be used to init aUIImage, like:UIImage(named: imageValue)
- The
-
Implement
ImageType.REQUIREto support using images viarequire(path/to/image)-
One way to implement is to use
Image.resolveAssetSource(source);from the RN docs. So we have something like:{ imageType: 'REQUIRE', imageValue: require('path/to/image.png') }.- Reference: Medium Article. Explains how
Image.resolveAssetSourceworks.
- Reference: Medium Article. Explains how
-
Attempted to impl. this but ran into problems: when in debug mode, assets are provided via a local URL via the metro bundler.
-