Skip to content

Rename start & end properties to fix conflict with RN 51#243

Closed
bilalsyed001 wants to merge 1 commit intoreact-native-linear-gradient:masterfrom
bilalsyed001:master
Closed

Rename start & end properties to fix conflict with RN 51#243
bilalsyed001 wants to merge 1 commit intoreact-native-linear-gradient:masterfrom
bilalsyed001:master

Conversation

@bilalsyed001
Copy link
Copy Markdown

This works for both iOS and Android.

credit @sjmueller , @MichaelDanielTom

Copy link
Copy Markdown

@jdonisvitch jdonisvitch left a comment

Choose a reason for hiding this comment

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

The syntax to change start and end to startPoint and endPoint looks correct. I'm curious what changes in react-native 0.51.0 caused the words to be forbidden or reserved? Thanks so much for fixing this. I hope it gets added asap! 👍 🙏

@terribleben
Copy link
Copy Markdown

It may have been this: facebook/react-native@38b5506

@sjmueller
Copy link
Copy Markdown
Contributor

@jdonisvitch I explained in the original PR #235

@KamranKhankhail
Copy link
Copy Markdown

It must be merged, as soon as possible.

@Kottidev
Copy link
Copy Markdown

Kottidev commented Dec 9, 2017

@dabit3

const {
children,
colors,
end,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

According to my tests, we can get this working by only changing the native properties' names. That is, the public interface of LinearGradient can continue to use start and end and it only uses startPoint and endPoint internally. This way, we can temporarily switch to this branch or fork without having to change our application code. Once this issue is fixed by the RN team, we can simply revert back to the main npm package and, again, make no changes to our application code base.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That is a really good point. It's not at the component level but at the internal level. Does the RN team believe this is a bug on their end?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Well I don't think having more explicit methods like setStartPoint and setEndPoint internally is an issue. So I'd say if only the internal implementation is updated, there's no fix need in React Native (if there ever is going to be one), and the library can just move forward.

Copy link
Copy Markdown
Collaborator

@sibelius sibelius left a comment

Choose a reason for hiding this comment

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

it looks good, this should be a major version release

@dannycochran
Copy link
Copy Markdown

Per comment in #244, the index.d.ts typings file should also be updated to use "startPoint" and "endPoint"

@raphaeleidus
Copy link
Copy Markdown

This changes the API. this should not be merged. in #235 @sjmueller was able to address the issue without changing the external API. This is strongly preferred

@sjmueller
Copy link
Copy Markdown
Contributor

I have updated my PR to support android, and it does not change the external API (as @raphaeleidus mentioned).

@kesha-antonov
Copy link
Copy Markdown

+++

@afilp
Copy link
Copy Markdown

afilp commented Dec 18, 2017

Can you please merge one or the other? We cannot release due to this and we cannot go back from 0.51 because 0.50 had another bug that was causing problems and now it is fixed.

@hwangjr
Copy link
Copy Markdown

hwangjr commented Dec 20, 2017

please merge this request, and release a new version, as soon as possible. thanks. @koenpunt

@mihir0x69
Copy link
Copy Markdown

Any word on this? I just updated to 0.51 and I really don't want to go back :|

@krailler
Copy link
Copy Markdown

I need this fix... :/

@techrah
Copy link
Copy Markdown

techrah commented Dec 20, 2017

It looks like #235 was merged instead.

@sibelius
Copy link
Copy Markdown
Collaborator

sibelius commented Feb 7, 2018

can we close this?

@abeddow91
Copy link
Copy Markdown

I'm getting this issue now with

react-native-linear-gradient@2.5.2
react-native: 0.57.7

any ideas?

@alphonse92
Copy link
Copy Markdown

Still happening: "react-native-linear-gradient": "^2.5.6",

@alphonse92
Copy link
Copy Markdown

If you still have this issue you must create a HOC to rename the props as you can see in this example:

image

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.