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
[SliderIOS] Add option for both min/max track image. #4586
Conversation
By analyzing the blame information on this pull request, we identified @manask88, @vjeux and @nicklockwood to be potential reviewers. |
Oh dude! Thanks! |
For backwards compatibility it might be prudent to keep support for |
Also, on naming: do we have a convention for using "minimum" and "maximum" or do we abbreviate to "min" and "max"? |
@ide +1 for keeping trackImage for backwards compatibility. Re: min/max, I think the convention for iOS-specific controls or properties is to stick with the UIKit name unless there's an existing web standard for the same concept. That may lead to inconsistencies though, as UIKit tends to use very verbose names and the web tends to be more terse. |
bf5ac7e
to
67325c5
Compare
@christopherdro updated the pull request. |
67325c5
to
a415c50
Compare
@christopherdro updated the pull request. |
Just updated backwards compatibility with Now, I'm thinking it makes sense to allow a single |
@christopherdro I just tried it, and it looks like the standard iOS UISlider behavior is to apply the inherited Since the iOS style convention is that only the left side is colored, and the right is gray, I'd avoid adding a new Calling the property |
FYI, I think the comment that the image must be stored in xcassets is incorrect. The image must be static, but it should work for any image file inside the application bundle, including ones bundled using the new image packaging system that @frantic added (where images are placed relative to the js files, and referenced with |
@nicklockwood I can confirm that using the new image packaging system does not work. Will try and take a closer look. |
This might be specific to UIExplore since image build script is missing. Although the inline image example from One thing that I noticed is that I can reference relative image files by somewhat sticking to the old syntax of Update: Adding a script to run react-native-xcode.sh seems like it won't work anyway without altering it to work with the way UIExplorer is setup. |
Ah, I think the problem is that we need to call resolveAssetSource() on all of the image props on the JS side before passing to native. |
Yea it's missing. Will get that implemented for this PR as well |
This is a followup to PR facebook#3850 but now seperates min/max track images into to different properties. Closes facebook#4476 mend
607ada7
to
a5967af
Compare
@nicklockwood Images with the new asset system should be working properly now. We should also make However, this brings up issue #4547 that I opened up a few days ago. |
@christopherdro updated the pull request. |
Question, how do we account for the cap insets of the left and right? For example, if I have a minimum track image that has a left cap curve, there's going to be an unwanted stretching behavior unless the image has the cap insets defined in order to let iOS know which part of the image to tile and leave the rest unstretched. Check out the description about the image: Defining the cap insets of the image: Perhaps we can introduce a |
I'm thinking that maybe capInsets should be defined in the imageSource object, along with width/height/scale. |
I just found out this API exists for Image components: https://facebook.github.io/react-native/docs/image.html#capinsets but don't know if there is overlap for implementation here. |
@rclai yeah, we support CapInsets on |
I plan on taking a further look at this shortly. Just caught up with another issue at the moment. |
I appears that the bundler handles determining the image size and scale whereas capInsets are going to be user defined. I've already tried using the original implementation of setting the UIEdgeInsets based on the width of the image, but provides a undesirable effect. See Demo I don't really see a way without altering resolveAssetSource and RCTConvert and having to the capInsets for each image. @nicklockwood Did you already have an idea of how this could be implemented? @rclai Could you provide some more information what your trying to achieve? Maybe some examples of the images? |
@christopherdro this tutorial is a perfect example of what I'm talking about: http://www.raywenderlich.com/32167/photoshop-tutorial-for-developers-creating-a-custom-uislider Notice the left and right curved caps, then at the bottom, you'll find the code needed to get make sure those caps are not stretched and the rectangle defined for tiling. PS - I'm not able to see the image you posted. |
@facebook-github-bot shipit |
Thanks for importing. If you are an FB employee go to https://our.intern.facebook.com/intern/opensource/github/pull_request/440883629449664/int_phab to review. |
I think I've found a good solution to the scalable image problem - at least, it allows you to specify track images with stretchable centers and fixed end-caps, which I think is the common case. For more complex patterns like zebra stripes we would need to support tiling, which would mean exposing additional configuration options, but that can be a job for another PR. |
@nicklockwood Sounds like a good solution. Do you think I should update the PR to use processColor for the tint color options or have that be separate? |
No need. Both colors and images are now handled automatically by the requireNativeComponent logic. |
👍 |
I'll figure out a proper solution for the color proptype warnings. It's silly to have to solve this individually in each place it's used. |
Thanks guys. |
Summary: This is a followup to PR #3850 but now separates min/max track images into different properties. Closes #4476 Add examples for `minimumTrackTintColor`, `maximumTrackTintColor`, `minimumTrackImage`, `maximumTrackImage` to UIExplorer. Closes facebook/react-native#4586 Reviewed By: svcscm Differential Revision: D2779193 Pulled By: nicklockwood fb-gh-sync-id: 0510a0f496816baacdd0d4be0f3cd3a63a5a9865
Summary: This is a followup to PR #3850 but now separates min/max track images into different properties. Closes #4476 Add examples for `minimumTrackTintColor`, `maximumTrackTintColor`, `minimumTrackImage`, `maximumTrackImage` to UIExplorer. Closes facebook/react-native#4586 Reviewed By: svcscm Differential Revision: D2779193 Pulled By: nicklockwood fb-gh-sync-id: 0510a0f496816baacdd0d4be0f3cd3a63a5a9865
This is a followup to PR #3850 but now separates min/max track images into different properties.
Closes #4476
Add examples for
minimumTrackTintColor
,maximumTrackTintColor
,minimumTrackImage
,maximumTrackImage
to UIExplorer.