From 8ee60e9b0dd53701d07862571990132cf4832b5e Mon Sep 17 00:00:00 2001 From: Yuanda Tang Date: Thu, 12 Jul 2018 13:06:44 -0700 Subject: [PATCH 001/861] Cleanup clang compiler warnings Summary: Cleanup clang compiler warnings. The last version delete some variables that still used in code. Fix the problem and try to launch again. Reviewed By: hershi Differential Revision: D8704442 fbshipit-source-id: 8bd37fc9f2b27104fe15c4c8b8323e2bfd8c1060 --- ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp b/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp index 10a3fb8268237f..fdb0f5544a3eec 100644 --- a/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp +++ b/ReactAndroid/src/main/jni/react/jni/CatalystInstanceImpl.cpp @@ -42,7 +42,6 @@ namespace { class Exception : public jni::JavaClass { public: - static auto constexpr kJavaDescriptor = "Ljava/lang/Exception;"; }; class JInstanceCallback : public InstanceCallback { From a2675ced4efe0df7745bf38908efa41d4d7a9841 Mon Sep 17 00:00:00 2001 From: Michael Ficaro Date: Thu, 12 Jul 2018 13:36:50 -0700 Subject: [PATCH 002/861] Adding new styling props to FlatList/VirtualizedList for ListHeaderComponent and ListFooterComponent Summary: We ran into a problem trying to style the optional prop `ListHeaderComponent` in the `FlatList` library component. Essentially we wanted to make `ListHeaderComponent` a flex item that filled all of the empty space in the list if there was any. Unfortunately the `ListHeaderComponent` is later wrapped in a `View` that blocked our styling. The `View` component was necessary as it added styling to handle inverting the `FlatList`. Similarly `ListFooterComponent` was handled the same way. We came up the simple solution of adding two new optional props, `ListHeaderComponentStyle` and `ListFooterComponentStyle`, that are of type `ViewStyleProp` that allow users to pass in styling for `ListHeaderComponent` and `ListFooterComponent`. With this change we were able to do something like the following to get the header component to fill all empty space in the `FlatList`. ``` } ListHeaderComponentStyle={{flexGrow: 1}} ... /> ``` This solution will give users a lot more freedom when working with headers and footers. Reviewed By: sahrens Differential Revision: D8777038 fbshipit-source-id: f34116ce68548ea70223e639d0f84a099327f6b3 --- Libraries/Lists/FlatList.js | 10 +++++++- Libraries/Lists/VirtualizedList.js | 24 ++++++++++++++++--- .../__snapshots__/FlatList-test.js.snap | 2 -- .../__snapshots__/SectionList-test.js.snap | 2 -- .../VirtualizedList-test.js.snap | 2 -- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index cfa4ae85808824..adebd267f7f64d 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -18,7 +18,7 @@ const StyleSheet = require('StyleSheet'); const invariant = require('fbjs/lib/invariant'); -import type {DangerouslyImpreciseStyleProp} from 'StyleSheet'; +import type {DangerouslyImpreciseStyleProp, ViewStyleProp} from 'StyleSheet'; import type { ViewabilityConfig, ViewToken, @@ -88,11 +88,19 @@ type OptionalProps = { * a rendered element. */ ListFooterComponent?: ?(React.ComponentType | React.Element), + /** + * Styling for internal View for ListFooterComponent + */ + ListFooterComponentStyle?: ViewStyleProp, /** * Rendered at the top of all the items. Can be a React Component Class, a render function, or * a rendered element. */ ListHeaderComponent?: ?(React.ComponentType | React.Element), + /** + * Styling for internal View for ListHeaderComponent + */ + ListHeaderComponentStyle?: ViewStyleProp, /** * Optional custom style for multi-item rows generated when numColumns > 1. */ diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 56364823f06d49..ba9224c4665fc9 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -31,7 +31,7 @@ const warning = require('fbjs/lib/warning'); const {computeWindowedRenderLimits} = require('VirtualizeUtils'); -import type {DangerouslyImpreciseStyleProp} from 'StyleSheet'; +import type {DangerouslyImpreciseStyleProp, ViewStyleProp} from 'StyleSheet'; import type { ViewabilityConfig, ViewToken, @@ -124,11 +124,19 @@ type OptionalProps = { * a rendered element. */ ListFooterComponent?: ?(React.ComponentType | React.Element), + /** + * Styling for internal View for ListFooterComponent + */ + ListFooterComponentStyle?: ViewStyleProp, /** * Rendered at the top of all the items. Can be a React Component Class, a render function, or * a rendered element. */ ListHeaderComponent?: ?(React.ComponentType | React.Element), + /** + * Styling for internal View for ListHeaderComponent + */ + ListHeaderComponentStyle?: ViewStyleProp, /** * A unique identifier for this list. If there are multiple VirtualizedLists at the same level of * nesting within another VirtualizedList, this key is necessary for virtualization to @@ -756,7 +764,12 @@ class VirtualizedList extends React.PureComponent { - + { // $FlowFixMe - Typing ReactNativeComponent revealed errors element @@ -892,7 +905,12 @@ class VirtualizedList extends React.PureComponent { - + { // $FlowFixMe - Typing ReactNativeComponent revealed errors element diff --git a/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap b/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap index d6d008065b2445..7f523be29ac848 100644 --- a/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap +++ b/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap @@ -60,7 +60,6 @@ exports[`FlatList renders all the bells and whistles 1`] = `
@@ -119,7 +118,6 @@ exports[`FlatList renders all the bells and whistles 1`] = `