-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Fix: RefreshControl in FlatList makes borderWidth not working #24411
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@janicduplessis yeah, you're right. In fact, margin properties only work on AndroidSwipeRefreshLayout and padding properties - only on ScrollView. So padding or margin doesn't get applied twice. But there is such a problem with opacity.
I don't know if you have some utility functions for extracting properties' family from style ("extract all margin properties" or something similar) to make code cleaner and more declarative. If you have I would use it. What do you think? |
I don't think we have anything currently to do this. I have something like this in an app though: const OUTER_PROPS = {
margin: true,
marginHorizontal: true,
marginVertical: true,
marginBottom: true,
marginTop: true,
marginLeft: true,
marginRight: true,
flex: true,
flexGrow: true,
flexShrink: true,
flexBasis: true,
alignSelf: true,
height: true,
minHeight: true,
maxHeight: true,
width: true,
minWidth: true,
maxWidth: true,
position: true,
left: true,
right: true,
bottom: true,
top: true,
};
export function splitLayoutProps(props) {
const inner = {};
const outer = {};
Object.keys(props).forEach(k => {
if (OUTER_PROPS[k] === true) {
outer[k] = props[k];
} else {
inner[k] = props[k];
}
});
return { outer, inner };
} You could also use @sahrens What do you think about this? |
@janicduplessis seems nice. We need to define where to place this utility function and OUTER_PROPS dictionary in the project. |
What's the status of this PR? |
@cpojer I suggest, we are waiting comments for the best code styling. The implementation itself will be fast. |
Yeah let's add a |
134292e
to
130b720
Compare
@sahrens @janicduplessis I've added splitLayoutProps to export with some tests to cover its functionality.
But as I check it works without it. So it's up to you whether to leave it or not. |
Any news?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Can you rebase it on top of master and use relative requires instead + remove the .vscode/settings.json
file? That file shouldn't go into this PR.
@cpojer yep, will do it soon |
4639a07
to
640211f
Compare
@cpojer done |
640211f
to
7862643
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This pull request was successfully merged by @Nizarius in d9a8ac5. When will my fix make it into a release? | Upcoming Releases |
Summary: Fixes #22752 On line 1021 you are passing base style to props: `style: [baseStyle, this.props.style],` Explicitly passing base style to ScrollView just overrides this line and doesn't let developers to customise style of any inheritors of ScrollView (not only FlatList) with custom RefreshControl. So this line (1113) seems to be removed. ## Changelog [GENERAL] [Fixed] - fix of Android's bug that doesn't let override ScrollView's Style with custom RefreshControl. Pull Request resolved: #24411 Differential Revision: D15713061 Pulled By: cpojer fbshipit-source-id: 461259800f867af15e53e0743a5057ea4528ae69
…ok#24411) Summary: Fixes facebook#22752 On line 1021 you are passing base style to props: `style: [baseStyle, this.props.style],` Explicitly passing base style to ScrollView just overrides this line and doesn't let developers to customise style of any inheritors of ScrollView (not only FlatList) with custom RefreshControl. So this line (1113) seems to be removed. ## Changelog [GENERAL] [Fixed] - fix of Android's bug that doesn't let override ScrollView's Style with custom RefreshControl. Pull Request resolved: facebook#24411 Differential Revision: D15713061 Pulled By: cpojer fbshipit-source-id: 461259800f867af15e53e0743a5057ea4528ae69
Summary
Fixes #22752
On line 1021 you are passing base style to props:
style: [baseStyle, this.props.style],
Explicitly passing base style to ScrollView just overrides this line and doesn't let developers to customise style of any inheritors of ScrollView (not only FlatList) with custom RefreshControl.
So this line (1113) seems to be removed.
Changelog
[GENERAL] [Fixed] - fix of Android's bug that doesn't let override ScrollView's Style with custom RefreshControl.
Test Plan
Use this code snippet to test that passing RefreshController doesn't break styling of ScrollView on Android.
The same for FlatList: