2017-01-04 03:53:50 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const components = [
|
|
|
|
'../Libraries/Components/ActivityIndicator/ActivityIndicator.js',
|
|
|
|
'../Libraries/Components/Button.js',
|
2017-10-08 00:17:09 +00:00
|
|
|
'../Libraries/Components/CheckBox/CheckBox.android.js',
|
2017-01-04 03:53:50 +00:00
|
|
|
'../Libraries/Components/DatePicker/DatePickerIOS.ios.js',
|
|
|
|
'../Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js',
|
2017-03-27 00:09:02 +00:00
|
|
|
'../Libraries/Lists/FlatList.js',
|
2017-01-04 03:53:50 +00:00
|
|
|
'../Libraries/Image/Image.ios.js',
|
|
|
|
'../Libraries/Components/Keyboard/KeyboardAvoidingView.js',
|
2017-03-27 00:09:02 +00:00
|
|
|
'../Libraries/Lists/ListView/ListView.js',
|
MaskedViewIOS -- A way to apply alpha masks to views on iOS
Summary:
It's very important in complex UIs to be able to apply alpha channel-based masks to arbitrary content. Common use cases include adding gradient masks at the top or bottom of scroll views, creating masked text effects, feathering images, and generally just masking views while still allowing transparency of those views.
The original motivation for creating this component stemmed from work on `react-navigation`. As I tried to mimic behavior in the native iOS header, I needed to be able to achieve the effect pictured here (this is a screenshot from a native iOS application):
![iOS native navbar animation](https://slack-imgs.com/?c=1&url=https%3A%2F%2Fd3vv6lp55qjaqc.cloudfront.net%2Fitems%2F0N3g1Q3H423P3m1c1z3E%2FScreen%2520Shot%25202017-07-06%2520at%252011.57.29%2520AM.png)
In this image, there are two masks:
- A mask on the back button chevron
- A gradient mask on the right button
In addition, the underlying view in the navigation bar is intended to be a UIBlurView. Thus, alpha masking is the only way to achieve this effect.
Behind the scenes, the `maskView` property on `UIView` is used. This is a shortcut to setting the mask on the CALayer directly.
This gives us the ability to mask any view with any other view. While building this component (and testing in the context of an Expo app), I was able to use a `GLView` (a view that renders an OpenGL context) to mask a `Video` component!
I chose to implement this only on iOS right now, as the Android implementation is a) significantly more complicated and b) will most likely not be as performant (especially when trying to mask more complex views).
Review the `<MaskedViewIOS>` section in the RNTester app, observe that views are masked appropriately.
![example](https://d3vv6lp55qjaqc.cloudfront.net/items/250X092v2k3f212f3O16/Screen%20Recording%202017-07-07%20at%2012.18%20PM.gif?X-CloudApp-Visitor-Id=abb33b3e3769bbe2f7b26d13dc5d1442&v=5f9e2d4c)
Closes https://github.com/facebook/react-native/pull/14898
Differential Revision: D5398721
Pulled By: javache
fbshipit-source-id: 343af874e2d664541aca1fefe922cf7d82aea701
2017-07-11 22:00:54 +00:00
|
|
|
'../Libraries/Components/MaskedView/MaskedViewIOS.ios.js',
|
2017-01-04 03:53:50 +00:00
|
|
|
'../Libraries/Modal/Modal.js',
|
|
|
|
'../Libraries/Components/Navigation/NavigatorIOS.ios.js',
|
|
|
|
'../Libraries/Components/Picker/Picker.js',
|
|
|
|
'../Libraries/Components/Picker/PickerIOS.ios.js',
|
|
|
|
'../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.android.js',
|
|
|
|
'../Libraries/Components/ProgressViewIOS/ProgressViewIOS.ios.js',
|
|
|
|
'../Libraries/Components/RefreshControl/RefreshControl.js',
|
|
|
|
'../Libraries/Components/ScrollView/ScrollView.js',
|
2017-03-27 00:09:02 +00:00
|
|
|
'../Libraries/Lists/SectionList.js',
|
2017-01-04 03:53:50 +00:00
|
|
|
'../Libraries/Components/SegmentedControlIOS/SegmentedControlIOS.ios.js',
|
|
|
|
'../Libraries/Components/Slider/Slider.js',
|
|
|
|
'../Libraries/RCTTest/SnapshotViewIOS.ios.js',
|
|
|
|
'../Libraries/Components/StatusBar/StatusBar.js',
|
|
|
|
'../Libraries/Components/Switch/Switch.js',
|
|
|
|
'../Libraries/Components/TabBarIOS/TabBarIOS.ios.js',
|
|
|
|
'../Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js',
|
|
|
|
'../Libraries/Text/Text.js',
|
|
|
|
'../Libraries/Components/TextInput/TextInput.js',
|
|
|
|
'../Libraries/Components/ToolbarAndroid/ToolbarAndroid.android.js',
|
|
|
|
'../Libraries/Components/Touchable/TouchableHighlight.js',
|
|
|
|
'../Libraries/Components/Touchable/TouchableNativeFeedback.android.js',
|
|
|
|
'../Libraries/Components/Touchable/TouchableOpacity.js',
|
|
|
|
'../Libraries/Components/Touchable/TouchableWithoutFeedback.js',
|
|
|
|
'../Libraries/Components/View/View.js',
|
|
|
|
'../Libraries/Components/ViewPager/ViewPagerAndroid.android.js',
|
2017-03-27 00:09:02 +00:00
|
|
|
'../Libraries/Lists/VirtualizedList.js',
|
2017-01-04 03:53:50 +00:00
|
|
|
'../Libraries/Components/WebView/WebView.ios.js',
|
|
|
|
];
|
|
|
|
|
|
|
|
const apis = [
|
2017-02-28 02:28:23 +00:00
|
|
|
'../Libraries/Components/AccessibilityInfo/AccessibilityInfo.ios.js',
|
2017-01-04 03:53:50 +00:00
|
|
|
'../Libraries/ActionSheetIOS/ActionSheetIOS.js',
|
|
|
|
'../Libraries/Alert/Alert.js',
|
|
|
|
'../Libraries/Alert/AlertIOS.js',
|
|
|
|
'../Libraries/Animated/src/AnimatedImplementation.js',
|
|
|
|
'../Libraries/ReactNative/AppRegistry.js',
|
|
|
|
'../Libraries/AppState/AppState.js',
|
|
|
|
'../Libraries/Storage/AsyncStorage.js',
|
2017-03-07 05:41:51 +00:00
|
|
|
'../Libraries/Utilities/BackAndroid.js',
|
|
|
|
'../Libraries/Utilities/BackHandler.ios.js',
|
|
|
|
'../Libraries/Utilities/BackHandler.android.js',
|
2017-01-04 03:53:50 +00:00
|
|
|
'../Libraries/CameraRoll/CameraRoll.js',
|
|
|
|
'../Libraries/Components/Clipboard/Clipboard.js',
|
|
|
|
'../Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js',
|
|
|
|
'../Libraries/Utilities/Dimensions.js',
|
|
|
|
'../Libraries/Animated/src/Easing.js',
|
|
|
|
'../Libraries/Geolocation/Geolocation.js',
|
|
|
|
'../Libraries/Image/ImageEditor.js',
|
|
|
|
'../Libraries/CameraRoll/ImagePickerIOS.js',
|
|
|
|
'../Libraries/Image/ImageStore.js',
|
|
|
|
'../Libraries/Interaction/InteractionManager.js',
|
|
|
|
'../Libraries/Components/Keyboard/Keyboard.js',
|
|
|
|
'../Libraries/LayoutAnimation/LayoutAnimation.js',
|
|
|
|
'../Libraries/Linking/Linking.js',
|
2017-03-27 00:09:02 +00:00
|
|
|
'../Libraries/Lists/ListView/ListViewDataSource.js',
|
2017-01-04 03:53:50 +00:00
|
|
|
'../Libraries/Network/NetInfo.js',
|
|
|
|
'../Libraries/Interaction/PanResponder.js',
|
|
|
|
'../Libraries/PermissionsAndroid/PermissionsAndroid.js',
|
|
|
|
'../Libraries/Utilities/PixelRatio.js',
|
|
|
|
'../Libraries/PushNotificationIOS/PushNotificationIOS.js',
|
|
|
|
'../Libraries/Settings/Settings.ios.js',
|
|
|
|
'../Libraries/Share/Share.js',
|
|
|
|
'../Libraries/Components/StatusBar/StatusBarIOS.ios.js',
|
|
|
|
'../Libraries/StyleSheet/StyleSheet.js',
|
|
|
|
'../Libraries/Performance/Systrace.js',
|
|
|
|
'../Libraries/Components/TimePickerAndroid/TimePickerAndroid.android.js',
|
|
|
|
'../Libraries/Components/ToastAndroid/ToastAndroid.android.js',
|
|
|
|
'../Libraries/Vibration/Vibration.js',
|
|
|
|
'../Libraries/Vibration/VibrationIOS.ios.js',
|
|
|
|
];
|
|
|
|
|
|
|
|
const stylesForEmbed = [
|
|
|
|
'../Libraries/Components/View/ViewStylePropTypes.js',
|
|
|
|
'../Libraries/Text/TextStylePropTypes.js',
|
|
|
|
'../Libraries/Image/ImageStylePropTypes.js',
|
|
|
|
];
|
|
|
|
|
2017-06-01 08:01:44 +00:00
|
|
|
const stylesWithPermalink = [
|
|
|
|
'../Libraries/StyleSheet/LayoutPropTypes.js',
|
|
|
|
'../Libraries/StyleSheet/TransformPropTypes.js',
|
|
|
|
'../Libraries/Components/View/ShadowPropTypesIOS.js',
|
|
|
|
'../Libraries/Components/View/ViewPropTypes.js',
|
2017-10-10 08:22:33 +00:00
|
|
|
].concat(stylesForEmbed);
|
2017-06-01 08:01:44 +00:00
|
|
|
|
2017-03-29 20:27:18 +00:00
|
|
|
const viewPropTypes = '../Libraries/Components/View/ViewPropTypes.js';
|
|
|
|
|
2017-01-04 03:53:50 +00:00
|
|
|
module.exports = {
|
|
|
|
components,
|
|
|
|
apis,
|
|
|
|
stylesWithPermalink,
|
|
|
|
stylesForEmbed,
|
2017-03-29 20:27:18 +00:00
|
|
|
viewPropTypes,
|
2017-01-04 03:53:50 +00:00
|
|
|
};
|