Closed shirakaba closed 5 years ago
TabView onSelectedIndexChange
isen't firing: https://github.com/shirakaba/react-nativescript/blob/master/react-nativescript/src/components/TabView.ts
Using the nativescript onSelectedIndexChanged method of the component fires undefined - and causes an issue with TabViewItem content not being shown.
I'd expect Page, View, and EditableTextBase to be reliable prototypes to refer to:
So the stuff in componentDidMount
and ComponentWillUnmount
in DatePicker and Slider for instance - should be in updateListeners
?
Good catch. That might be down to a typo; I should name it onSelectedIndexChange
rather than onSelectedIndexChanged
as per Triniwiz's advice in #26.
I'll make that fix on master for now.
EDIT: done in e46cb1f
.
So the stuff in componentDidMount and ComponentWillUnmount in DatePicker and Slider for instance - should be in updateListeners?
Yes, I believe so. Originally, I did everything separately across componentDidMount
, componentWillUnmount
, and shouldComponentUpdate
for all components, but now this is abstracted by Observable into one convenient (yet somewhat unintuitive) updateListeners
method to reduce code repetition.
Good catch. That might be down to a typo; I should name it onSelectedIndexChange rather than onSelectedIndexChanged as per Triniwiz's advice in #26.
SegmentedBar currently has i'ts prop named: onSelectedIndexChanged
Thanks; fixed in: 61f80e9 (will create release later).
I've now released v0.13.0.
Event handlers now return NarrowedEventData rather than the value concerned (e.g. no longer return time
for onTimeChange
but simply args
); reverting to this simpler pattern reduces code size and was a simple way to fix such event handlers so that they can now be updated during component's lifecycle.
I reckon I've fixed TabView. Some components in NativeScript Core exceptionally use onSelectedIndexChanged
while others use onSelectedIndexChange
, which confused things.
I haven't thought about this for a while and have forgotten what's going on.
1) Slider doesn't implement
updateListeners()
:https://github.com/shirakaba/react-nativescript/blob/master/react-nativescript/src/components/Slider.ts
2)
"submit"
and"close"
are implemented in SearchBar'supdateListeners
, but only"textChange"
is mentioned in itscomponentDidMount
andcomponentWillUnmount
methods.https://github.com/shirakaba/react-nativescript/blob/master/react-nativescript/src/components/SearchBar.ts
I'd expect Page, View, and EditableTextBase to be reliable prototypes to refer to:
https://github.com/shirakaba/react-nativescript/blob/master/react-nativescript/src/components/Page.ts
https://github.com/shirakaba/react-nativescript/blob/master/react-nativescript/src/components/View.ts
https://github.com/shirakaba/react-nativescript/blob/master/react-nativescript/src/components/EditableTextBase.ts
I'll look into them when I have a moment.