Removed Bridge dependency from image props on Fabric (iOS) #607
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The React Native
Slider
component has image props, for example,trackImage
. When first migrating to Fabric, tried to copy theSlider
implementation for the image props onBarButton
andTabBarItem
components. But it uses c++ state which isn’t documented anywhere. So used the ImageLoader module. But it was only a temp solution because it relied onRCTBridge+Private.h
. This PR replaces the temp solution with the Slider's c++ implementation.The ‘Write You Own State’ solution suggested by React Native put me off trying c++ state because it didn’t seem right hand-writing all the codegen classes. But discovered the
interfaceOnly
flag setting in the NativeComponent.js spec. This still codegens the Props and EventEmitter - classes that change when the spec changes - but not the ComponentDescriptor, State and ShadowNode. These can be handwritten to implement custom State like image props.Had to update the
source_files
of the podspec so these hand-written classes were included in the iOS project. But getting these files included on Android is much harder. Even though these files aren’t used on Android, the build fails without them. Had to include them in the Android.mk of the app (user changes).Also had to include
mapbuffer
andimagemanager
in LOCAL_SHARED_LIBRARIESAnd in MainComponentsRegistry.cpp had to include the hand-written ComponentDescriptors because they’re not part of the codegen’ned descriptors anymore.