mirror of
https://github.com/status-im/react-native.git
synced 2025-01-17 13:01:13 +00:00
77b8c09727
Summary: This re-implements sticky headers in JS to make it work on Android. The only change that was needed was to expose a way to attach a an animated value to an event manually since we can't use the Animated wrapper and `Animated.event` to do it for us because this is implemented directly in the `ScrollView` component. Simply exposed `attachNativeEvent` that takes a ref, event name and event object mapping. This is what is used by `Animated.event`. TODO: - Need to check why momentum scrolling isn't triggering scroll events properly on Android. - Remove native iOS implementation - cleanup / fix flow **Test plan** Test the example list in UIExplorer, test the ListViewPaging example. Closes https://github.com/facebook/react-native/pull/11315 Differential Revision: D4450278 Pulled By: sahrens fbshipit-source-id: fec8da2cffce9807d74f8e518ebdefeb6a708667
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
/**
|
|
* 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.
|
|
*
|
|
* @providesModule Animated
|
|
* @flow
|
|
*/
|
|
'use strict';
|
|
|
|
|
|
var AnimatedImplementation = require('AnimatedImplementation');
|
|
var Image = require('Image');
|
|
var Text = require('Text');
|
|
var View = require('View');
|
|
|
|
let AnimatedScrollView;
|
|
|
|
const Animated = {
|
|
View: AnimatedImplementation.createAnimatedComponent(View),
|
|
Text: AnimatedImplementation.createAnimatedComponent(Text),
|
|
Image: AnimatedImplementation.createAnimatedComponent(Image),
|
|
get ScrollView() {
|
|
// Make this lazy to avoid circular reference.
|
|
if (!AnimatedScrollView) {
|
|
AnimatedScrollView = AnimatedImplementation.createAnimatedComponent(require('ScrollView'));
|
|
}
|
|
return AnimatedScrollView;
|
|
},
|
|
};
|
|
|
|
Object.assign((Animated: Object), AnimatedImplementation);
|
|
|
|
module.exports = ((Animated: any): (typeof AnimatedImplementation) & typeof Animated);
|