Is the React Native component hierarchy documented anywhere? If so, where or how? - react-native

I can't find any inheritance diagrams (or any documentation at all) of what components inherit from.
For instance, it seems that TouchableWithoutFeedback is the parent superclass of TouchableHighlight and TouchableOpacity (because TouchableWithoutFeedback contains the methods onPressIn and onPressOut).
I'm looking for something like the bottom half of this inheritance chain documentation (for a different technology) that lists all the superclass methods.

You'll have to dive into the source code. But as a guide, no component inherits from any other Component. Every component just extends Component or maybe PureComponent.
For instance here is TouchableNativeFeedback - https://github.com/facebook/react-native/blob/b7bb2e5745f2bdbfeeccef8d97d469730942e01c/Libraries/Components/Touchable/TouchableNativeFeedback.android.js
Yes some of the props are shared between components, like View ScrollView. And as you mentioend above. but this is not due to inheritance. The docs make this clear by using spread operator on props. For instance:
The text component: https://facebook.github.io/react-native/docs/text.html#style
Has same style properties as View as indicatated by View Style Props...:
Same with the TouchableNativeFeedback it has TouchableWithoutFeedback props... - https://facebook.github.io/react-native/docs/touchablenativefeedback.html#props :

Related

Iconic Vue PopoverController/ModalController with custom events

I am trying to use the PopoverController in Ionic 6 with Vue 3 (Composition API). Now, as I can not just add an #custom-event to my popover, I do not know, how to respond to custom events from my popover inside the parent component. Of course, you could pass callbacks as props, but that's pretty much an anti-pattern in vue.
Any ideas on how to pass custom events from the popover created by the popover controller to the parent?

Trigger animation from viewmodel

I have a simple design question (I know, no code, it's more about the mvvm pattern): my app shows a map, its viewmodel contains upper left and down-right coordinates.
If I want to move the view, I can change these coordinates.
But what if I want to animate this change ? Like in google earth. I know I can do a storyboard, animate the dependency properties and so on at the view level, but how would I say from the viewmodel "hey, start this storyboard with these target values" ?
The easiest solution would be to fire the event by setting a property bound to the view, but it would require a class that would be known from the view and the viewmodel.
Another would be to use a Mediator/Messenger, but I think it's more used to communicate between viewmodels.
I think there must be a cleaner way.
Thanks for any help.
I found a (rather complicated but consistent) answer from Josh Smith blog.
Here it is, for those who might be interested:
https://joshsmithonwpf.wordpress.com/2009/04/25/orchestrating-animated-transitions-between-view-and-viewmodel/

How to add analytics code in React Native lifecycle

I have a TabBarIOS which contains five navigators. I need to track each view on screen for google analytics, but ReactNative doesn't provide a lifecycle for that.
I'v tried to track in the componentDidMount of those views, but it will be only called once in its lifecycle for each view. Switching between tabs will not trigger componentDidMount again.
Furthermore, when I push()/pop() a view into/from a navigator, I need a callback to find which component will be shown.
Is there any callback method or delegate method which would be called when a component is going to show (like -viewDidAppear: in iOS)?
TabBarIOS.Item has a property named onPress() that gets called when the item is pressed. You can use this callback to update analytics.

CUBA : inject Container in Editor

I have a standard ProductEdit screen extending AbstractEditor.
I am trying to #Inject the root Container of the components hierarchy, in order to walk the hierarchy and add a ValueChangeListener that would change the style.
To do so, I injected the scroll box which is the root in this case. No chance (NPE, no injection).
Then I tried upwards by calling getParent() on one of the component I injected, no parent, NPE.
How can I walk the component hierarchy with CUBA ?

Application Design Question

I have an application that uses a UITabBarController as its outer container. Each tab uses a UINavigationController for its root view controller. I employ a multi-button toolbar as the navigation bar's right bar button. Some of these toolbar buttons are universal to the application; some pertain to individual tabs.
My instinct is to create a base view controller class with all universal toolbar construction and implementation code, then have each of my root view controllers inherit from this base class. If they want to add additional buttons to the toolbar, they simply need to override the toolbar construction method (where I'll centralize the construction of the tool bar), and add the implementation code for the additional buttons.
Sounds good in theory, but since I'm new to Objective-C, I welcome any additional input/advice from more experienced developers.
If you have a enough reusable code in your "toolbar construction and implementation " to motivate you to implement a base class and reuse it on your child classes, then it actually sounds like a good solutions.
One thing that you should analyze is which class would you extend: UIViewController or UIToolBar.
If you just want a custom reusable toolbar that only changes some visual properties (like the label of a the left button, or let the right button visible or not, etc..), maybe the best approach is to implement a base class that extends from UIToolBar, and then use it in your view controllers.
But if you have a considerable complex logic handling actions from the buttons of the toolbar, or any "heavy code" beyond simple visual property settings, the creation of a base class that extends UIViewController sounds like a better approach.
The better choise is up to you and to what you want to implement/reuse.
Good luck!