Skip to content

fix wheelpicker in android #2558

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 10 commits into from
May 1, 2023
Merged

fix wheelpicker in android #2558

merged 10 commits into from
May 1, 2023

Conversation

adids1221
Copy link
Contributor

@adids1221 adids1221 commented Apr 16, 2023

Description

WheelPicker missing data in Android bug fix, passing maxToRenderPerBatch to the FlatList when using Android.

Changelog

WheelPicker missing data in Android bug fix, passing maxToRenderPerBatch to the FlatList when using Android.
Solve RN FlastList issue.
WOAUILIB-3440

@adids1221 adids1221 marked this pull request as ready for review April 19, 2023 07:56
@adids1221 adids1221 requested a review from M-i-k-e-l April 19, 2023 07:59
@adids1221
Copy link
Contributor Author

@M-i-k-e-l If you want to test the solution you can use version 2.76143.0.
I'm not sure about the warning sign in the changelog, tell me what you think.

Copy link
Collaborator

@M-i-k-e-l M-i-k-e-l left a comment

Choose a reason for hiding this comment

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

The solution looks good generally and it is working, however I would not want it forced on all of our users.
Can you think of another solution?

@M-i-k-e-l
Copy link
Collaborator

@M-i-k-e-l If you want to test the solution you can use version 2.76143.0. I'm not sure about the warning sign in the changelog, tell me what you think.

Generally I'd avoid two lines in the changelog since I don't think our script handles that well.

@adids1221
Copy link
Contributor Author

The solution looks good generally and it is working, however I would not want it forced on all of our users. Can you think of another solution?

There are no performance issues when the list is small (or less than 20 items).
In that case, forcing it on all the users will fix the bug and the performance will impact only "big data" lists.

I don't think we need it as a prop inside WheelPicker since it will force us to go over many components which use the WheelPicker.

@adids1221 adids1221 requested a review from M-i-k-e-l April 20, 2023 10:08
@M-i-k-e-l
Copy link
Collaborator

There are no performance issues when the list is small (or less than 20 items). In that case, forcing it on all the users will fix the bug and the performance will impact only "big data" lists.

I don't think we need it as a prop inside WheelPicker since it will force us to go over many components which use the WheelPicker.

  1. We don't need a new prop.
  2. What if someone has a long list and only uses iOS? Why should they suffer performance degradation?

@adids1221
Copy link
Contributor Author

There are no performance issues when the list is small (or less than 20 items). In that case, forcing it on all the users will fix the bug and the performance will impact only "big data" lists.
I don't think we need it as a prop inside WheelPicker since it will force us to go over many components which use the WheelPicker.

  1. We don't need a new prop.
  2. What if someone has a long list and only uses iOS? Why should they suffer performance degradation?

the androidFlatListProps object will return the maxRenderPerBatch prop only if the user has an Android device.
I'm using this line if (Constants.isAndroid) inside the useMemo.
So if the user uses an IOS device it will return undefined.

@M-i-k-e-l
Copy link
Collaborator

There are no performance issues when the list is small (or less than 20 items). In that case, forcing it on all the users will fix the bug and the performance will impact only "big data" lists.
I don't think we need it as a prop inside WheelPicker since it will force us to go over many components which use the WheelPicker.

  1. We don't need a new prop.
  2. What if someone has a long list and only uses iOS? Why should they suffer performance degradation?

the androidFlatListProps object will return the maxRenderPerBatch prop only if the user has an Android device. I'm using this line if (Constants.isAndroid) inside the useMemo. So if the user uses an IOS device it will return undefined.

True 🤦 🙃 But I still think this should be in private and not affect all the public users

@adids1221
Copy link
Contributor Author

@M-i-k-e-l As we spoke the user can pass flatListProps={{maxToRenderPerBatch: undefined}} to the WheelPicker and override the prop we pass to solve this issue.

@M-i-k-e-l
Copy link
Collaborator

@M-i-k-e-l As we spoke the user can pass flatListProps={{maxToRenderPerBatch: undefined}} to the WheelPicker and override the prop we pass to solve this issue.

Lets document this properly

@adids1221
Copy link
Contributor Author

@M-i-k-e-l After checking with Ethan, I add the RN issue link to the component note.

@@ -2,6 +2,7 @@
"name": "WheelPicker",
"category": "form",
"description": "A customizable WheelPicker component",
"note": "When using Android by default the FlatList will have 'maxToRenderPerBatch' prop set to items.<br/>length to solve FlatList bug on Android, you can override it by passing your own 'flatListProps' with 'maxToRenderPerBatch' prop.<br/>See the RN FlatList issue for more info: https://github.com/facebook/react-native/issues/15990",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I did not test it but I assume items.<br/>length will look strange, it should probably be in the same line and preferably with code look (if possible in the note): items.length

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, checked.
Wrapped with <code>Text...</code>

@adids1221 adids1221 enabled auto-merge (squash) May 1, 2023 13:33
@adids1221 adids1221 merged commit da05ccb into master May 1, 2023
lidord-wix pushed a commit that referenced this pull request May 15, 2023
* fix wheelpicker in android

* Removed initialNumToRender, removed style

* removed itemLength variable

* opt-out

* added flatListProps to wheelPicker.api

* added note to the api.json file

* refactor the nore

* fixed note

* minor fix
@M-i-k-e-l
Copy link
Collaborator

M-i-k-e-l commented May 24, 2023

@M-i-k-e-l If you want to test the solution you can use version 2.76143.0. I'm not sure about the warning sign in the changelog, tell me what you think.

Generally I'd avoid two lines in the changelog since I don't think our script handles that well.

@adids1221
Please avoid multiline in the changelog in the future + the internal ticket is never added as well

@adids1221 adids1221 deleted the fix/WheelPicker_android branch June 29, 2023 12:28
prsvic added a commit to dialectlabs/react-native-ui-lib that referenced this pull request Aug 30, 2023
* Picker - remove commented out code related to 'renderNativePicker' deprecated prop

* Incubator.Dialog - fix RN Modal native calls on RN71 (wix#2573)

* CharCounter now working with emojis (16-bit code) (wix#2570)

* CharCounter now working with emojis (16-bit code)

* Fixed review notes

* SortableList - adding important note

* fix wheelpicker in android (wix#2558)

* fix wheelpicker in android

* Removed initialNumToRender, removed style

* removed itemLength variable

* opt-out

* added flatListProps to wheelPicker.api

* added note to the api.json file

* refactor the nore

* fixed note

* minor fix

* Align LogService with console (wix#2577)

Allow sending multiple params and allow (any) objects

* Incubator.Dialog - fix test after RN71 bug fix (wix#2575)

* Incubator.Dialog - fix test after RN71 bug fix

* Forgot this

* Replacing 'react-native-text-size' with wix fork (wix#2542)

* Replacing 'react-native-text-size' with wix fork

* fix version

* Enable TS check on demo files and fix all errors (wix#2585)

* Enable TS check on demo files and fix all errors

* Code review fixes

* Add space - test commit

* Remove space

* Revert changes in margin modifiers typings

* SortableGridList tests (wix#2586)

* Upgrade reanimated to 2.17 (wix#2587)

* HintsScreen - allow configuration (wix#2590)

* Move to reanimated 3 (wix#2593)

* Move to reanimated 3

* Improve wording

* FloatingPlaceHolder animation fix (wix#2591)

* Picker - fix listProps type to be Partial (wix#2596)

* Add setBreakpoints and getPageMargins (wix#2576)

* Slider - adding 'migrate' prop to allow using Incubator.Silder (wix#2592)

* GradientSlider - adding 'migrate' prop to allow using Incubator Silder instead of old implementation

* fix lint and ts

* Slider - add the 'migrate' prop to use Incubator.Slider

* Incubator.Slider - fix how we apply 'tumbTintColor' to match old Slider

* Demo screen - add the 'migrate' prop

* remove duplicate prop declaretion

* comments

* adding prop to api json

* pr comments fix

* example margins

* removing migrate from old screen

---------

Co-authored-by: M-i-k-e-l <[email protected]>

* iOS - change bundle id and set min deployment to iOS 13.0 (wix#2597)

* iOS - set min deployment to iOS 13.0

* Demo - change bundle id to allow running on iOS device

* DateTimePicket - add validate (wix#2601)

* Feat/ Support subtitle in Modal.TopBar (wix#2594)

* Support subtitle in Modal.TopBar

* bodySmall

* Add contribution link in the our main readme file

* Incubator.Slider - fix onValueChange throttle (wix#2598)

ColorPicker - add 'migrate' prop to use new SliderImplementation

* Calendar demo screen - move items load to componentDidMount

* Feat/ SortableList - add ItemMargin prop (wix#2561)

* add ItemMargin prop

* move height calculation

* renaming

* Prettify

---------

Co-authored-by: M-i-k-e-l <[email protected]>

* DateTimePicker - fix TextField migration related TS errors (wix#2604)

* TextField and Switch/ forward id prop (wix#2608)

* TextField: forward containerId prop

* code-review

* code-review

* Calendar - Day - memoize everything

* Fix the Wizard.Step style according to the guidelines (wix#2609)

* Fix the Wizard.Step style according to the guidelines

* changed bottom divider color

* Release notes script - fix and improve (wix#2605)

* Release notes script - fix and improve

* Move logic to functions

* Move silentPRs

* Oops

* Error in red + align a little to private

* Support input params

* Rename to Additional info (and add to PR template) + improve error message

* Small fix

* getItemIndex - improve comparison by not using isSameMonth tool

* Calendar getItemIndex - revert fix

* Calendar - getItemIndex - fix

* Fix how we handle style in our Svg image component for web (wix#2612)

* Fix how we handle style in our Svg image component for web

* fix how we clone style object

* GridView and SortableGridView - support tablet and other fixes (wix#2611)

* GridView and SortableGridView - support tablet and other fixes

* Cannot warn since we're already using this internally without setting

* Include TouchableOpacityProps in SwitchProps (wix#2613)

* Improving date utils (wix#2610)

* Improving date utils

* replacing function

* revert function change

* Moving 'inactive' day logic from Week to Day

* Header - addMonths - improve flow

* Header - convert to dateObject only for staticHeader

* pr comments

* Support passing labelProps to TabController item (wix#2615)

* Incubator.Slider - fix types (wix#2616)

* WheelPicker - Android - fix missing values when initialValue is sent (wix#2618)

* Width and height props added to Icon, passed only in case of svg icon (wix#2583)

* Width and height props added to Icon, passed only in case of svg icon

* fixed review notes

* passing iconSiez to svg image

> The code looks good, you can merge if you've tested it (on both platforms)

* fix: setNativeProps not supported on web (wix#2620)

* Incubator.TextField - fix context menu not showing in centered and empty input (wix#2617)

* Comment some code in calendar

* Infra/ set infra for users recordings (wix#2437)

* set recorder infra

* update snapshots

* remove default recorderTag

* fix priority

* add fs support to more components

* update toast + api

* fix merge

* fix snapshots

* unmask TextField label, floatingPlaceholder and charCounter

* review fixes

* add RecorderProps type

* prettify

* change to interface

* formatting

* move recorder typings to typings directory

* fix chip api

* IncubatorDialog - add topAccessory (wix#2621)

* fix recorder typings (wix#2624)

* export RecorderProps

* fix export

* Picker update items when children is changed (wix#2599)

* Picker update items when children is changed

* Code refactor

* update api.json file

* fixed review notes

* refactor renderItem

* items type update

* Infra/test kit add props (wix#2619)

* testkit - add props generics

* Fix some TS errors and accessibility bugs

* DateTimePicker - start deprecation of moment props (wix#2625)

* feat: add prop onValidateFailed to TextField (wix#2626)

* feat: add prop onValidateFailed to TextField

* code-review

* Fix prReleaseNotesCommon file type

* Fixed TabBar scroll when there is selected index (wix#2630)

* Incubator.TextField - expose retainValidationSpace (wix#2631)

* Add "light-date" to demo's dependencies

* Incubator.Slider - fix gap not equal on both max and min ends (wix#2634)

* SegmentedControl - onChangeIndex should react to changes (wix#2637)

* ExpandableOverlay - add migrateDialog (wix#2635)

* textField centerd style dependes on fieldState.value

* TextField inputStyle hasValue refactor

* webDemo react-native-gesture-handler version upgrade (wix#2647)

* ColorPicker - small fixes (wix#2650)

* webDemo reanimated version upgrade to 3 (wix#2649)

* NumberInput - fix design (MaskedInput look) (wix#2645)

* NumberInput - fix design (MaskedInput look)

* Fix some types and the API

* Remove getInitialData and parsePastedData

* Remove Clipboard dependency

* Remove decimal separator from input (not from initial)

* Fix (most) tests and package.json

* Remove unused prop

* Support validateOnBlur

* Add textStyle

* Add factor

* Fix

* Add Incubator.Slider driver (wix#2629)

* Feat/color picker add full color to result (wix#2651)

* ColorPicker - small fixes

* ColorSwatch - refactor result

* Add hexString

* Rename to value

* Rename to value 2

* Rename to ColorInfo

* Infra/ remove useCustomTheme leftovers (wix#2666)

* feat: [MAW-257] svgImage support tintColor on web (wix#2667)

* feat: [MAW-257] svgImage support tintColor on web

* use StyleSheet.flatten

* Picker fix for validateForm (wix#2661)

* NumberInput - fix editable (wix#2664)

* Picker example for the webDemo (wix#2622)

* Picker exmaple for the webDemo

* new picker dialog example

* Fix svg example

* fixed review comments

---------

Co-authored-by: lidord-wix <[email protected]>

* testkit - new iteration (wix#2655)

* testkit - new iteration

* Minor improvements

* Add DEFAULT_LIST_ITEM_HEIGHT and SortableListDriver

* Flatten actions

* NumberInput - support focus (wix#2671)

* NumberInput - support focus

* Add focus color and fix screen onBlur

* feat/enhance text highlight string (wix#2663)

* extended the `Text` component `highlightString` prop, to allow it to also receive a `HighlightStringProps` object (or an array of such objects) that enables the user to handle a highlight string `onPress` event, provide a style per highlight string and give it a `testID` for testing

* fix lint warning

* fix docs

* review fixes

* Scheme - fix color changing (wix#2607)

* Scheme - fix flickering

* Update src/commons/asBaseComponent.tsx

Co-authored-by: Ethan Sharabi <[email protected]>

---------

Co-authored-by: Ethan Sharabi <[email protected]>

* Text - default alignment (wix#2670)

* Text - removing default text alignment (set to left) to allow children to get parent alignment (issue is on iOS only)

* update snapshot tests - Button, AvatarScreen

* Replacing default textAlign with writingDirection to fix rtl

* Adding writingDirectionTypes and updating snapshot tests

* adding comment

* ExpandableOverlay - fix dialog props (wix#2675)

* Picker migrate Dialog (wix#2657)

* Picker migrate Dialog

* exported close expandable function

* removed dialogProps prop from types file

* added bak the native picker example

* fixed the ts error on ExpandableOverlay dialogProps in Picker. (wix#2677)

* fixed the ts error on ExpandableOverlay dailogProps in Picker.

* removed the migrateDialog prop

* declare other global typings (wix#2678)

* declare other global typings

* Cleanup old typings

* Create common typings and fix import paths

* Remove old typings folder

* Remove measureme typings

* Move fsTagName global interface to recorderType file

* fix: Picker label not updating when items prop changes (wix#2682)

* change margin to padding (wix#2683)

* ScrollBar - fix scrolling inside Dialog on Android (wix#2695)

* use ScrollView and FlatList from gesture-handler

* formatting

* Android build - fix kotlin version

* Performance - remove keys, simplify isSameDay + prettify

* Performance - simplify isSameMonth + add  some types + prettify

* Remove logs from tests

* Week - reducing lodash import

* Removing isToday() tool

* fix bg logic

* Performance - isPastDate

* Performance - isPastDate - revert

* Header - adding throttle to arrow press

* Refactor Day component to not use animated styles (wix#2698)

* Refactor Day component to not use animated styles

* Remove unnecessary null check

* Calendar - fix extra space at the bottom

* Fix initialization of calendar items to not be called more than once

* Enable Calendar agenda in example screen

* Fix tests' TS

* Header - fix non-static header title

* Update calendars mocks

* Agenda - refactor

* Header - fix initial title

* View - add reanimated props for layout animation (wix#2694)

* No static locale infra (wix#2684)

* CalendarItem - fix default height

* Demo - adding RTL screen (wix#2668)

* Text - revert Android alignment (wix#2701)

* Revert "No static locale infra (wix#2684)" (wix#2702)

This reverts commit 295e12e.

* ColorPicker - allow theme (wix#2704)

* ColorPicker - allow theme

* Add props

Co-authored-by: Inbal Tish <[email protected]>

---------

Co-authored-by: Inbal Tish <[email protected]>

* Slider - fix value out of range warning in range slider (wix#2709)

* Add key to BadgeProps (wix#2689)

* wheel picker onlayout fix (wix#2705)

* wheel picker onlayout fix

* removed comments

* limit picker number of lines (wix#2712)

* Expose TypographyKeys (wix#2715)

* Fix RTL on Android (wix#2717)

* Fix picked reanimated typings (wix#2726)

* remove ThemeComponent leftovers (wix#2719)

* Picker modal list testID (wix#2723)

* add testID for picker modal list

* add testID for picker modal list

* add testID for picker modal list

* fix lint

* fix: [WEB] SvgImage update styles (wix#2728)

* fix: [WEB] SvgImage update styles

* fix sizing of svg wrapper

* code review

---------

Co-authored-by: Inbal Tish <[email protected]>
Co-authored-by: Miki Leib <[email protected]>
Co-authored-by: Adi Mordo <[email protected]>
Co-authored-by: Inbal Tish <[email protected]>
Co-authored-by: Ethan Sharabi <[email protected]>
Co-authored-by: Lidor Dafna <[email protected]>
Co-authored-by: M-i-k-e-l <[email protected]>
Co-authored-by: Amit Shwarts <[email protected]>
Co-authored-by: lidord-wix <[email protected]>
Co-authored-by: Oren Zakay <[email protected]>
Co-authored-by: israelko <[email protected]>
Co-authored-by: Liat Netach <[email protected]>
Co-authored-by: yuvalsho <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants