这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@yulolimum
Copy link
Member

Please verify the following:

  • yarn test jest tests pass with new tests, if relevant
  • README.md has been updated with your changes, if relevant

Describe your PR

@robinheinze reported that the app she is working on has a weird screen offset when the Toggle is used. The reason for that is this issue: software-mansion/react-native-reanimated#3368

The Toggle switch-variant uses reanimated's FadeIn. This was added to give the switch time to calculate the knob width to determine its position along the track. This was needed in case the component overrides specified a percentage width for the knob.

I think it's reasonable to only allow point values for knob width customization. This cleans up the switch code and remove the need for measuring, which in effect, removes the need for the FadeIn.

This PR also separates the Types for the different Toggle variants for better prop hover descriptions and prop matches.

This PR also adds the ability to customize the checkbox-variant icon.

…entage values for the switch knob, simplifying the implementation.
Copy link
Contributor

@frankcalise frankcalise left a comment

Choose a reason for hiding this comment

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

Looks good to me, added a couple of minor questions

@yulolimum
Copy link
Member Author

added a couple of minor questions

Hey boss, I dont see any comments.

* Default: "checkbox"
*/
variant?: Variants
variant?: unknown
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this go away since provided in each of the 3 types making up the discriminating union? Genuinely asking for my own understanding as I was trying to write some dynamic props earlier in the week

Copy link
Member Author

Choose a reason for hiding this comment

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

I have this here for the description mainly. If I add descriptions to the 3 Types, then the documentation for the selected discriminating prop will be used.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh ok cool thanks

@frankcalise
Copy link
Contributor

added a couple of minor questions

Hey boss, I dont see any comments.

Weird, I must have not hit Start a review before - I added them back in

@yulolimum yulolimum merged commit c6181c4 into master Nov 21, 2022
@yulolimum yulolimum deleted the fix/switch-toggle branch November 21, 2022 22:11
infinitered-circleci pushed a commit that referenced this pull request Nov 21, 2022
## [8.4.2](v8.4.1...v8.4.2) (2022-11-21)

### Bug Fixes

* **boilerplate:** Simplifies Toggle's switch-variant to not require measuring logic. Adds icon customization to Toggle's checkbox-variant. ([#2315](#2315) by [@yulolimum](https://github.com/yulolimum)) ([c6181c4](c6181c4))
@infinitered-circleci
Copy link
Collaborator

🎉 This PR is included in version 8.4.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants