mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
RN: Add Missing @format Annotations (#51415)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51415 Adds the `format` annotation to all files that were missing them. Also, adds `noformat` to generated files, and removed it from files that no longer need them. Changelog: [Internal] Reviewed By: SamChou19815 Differential Revision: D74901034 fbshipit-source-id: 7e0b85ca8ee2de41278f3aa23cb03e9c266d9c28
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ef17880fb0
commit
ba092bfaba
@@ -5,7 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict-local
|
||||
* @noformat
|
||||
* @format
|
||||
*/
|
||||
|
||||
const path = require('path');
|
||||
@@ -33,4 +33,4 @@ if (process.env.REACT_NATIVE_DEBUGGER_FRONTEND_PATH != null) {
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = (frontEndPath /*: string */);
|
||||
module.exports = frontEndPath /*:: as string */;
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
|
||||
+2
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
+48
-16
@@ -3,25 +3,45 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @lint-ignore-every LICENSELINT
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const tsComponentFixturePath = path.join(__dirname, '../../react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js');
|
||||
const tsComponentSnapshotPath = path.join(__dirname, '../../react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap');
|
||||
const tsModuleFixturePath = path.join(__dirname, '../../react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js');
|
||||
const tsModuleSnapshotPath = path.join(__dirname, '../../react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap');
|
||||
const tsComponentFixturePath = path.join(
|
||||
__dirname,
|
||||
'../../react-native-codegen/src/parsers/typescript/components/__test_fixtures__/fixtures.js',
|
||||
);
|
||||
const tsComponentSnapshotPath = path.join(
|
||||
__dirname,
|
||||
'../../react-native-codegen/src/parsers/typescript/components/__tests__/__snapshots__/typescript-component-parser-test.js.snap',
|
||||
);
|
||||
const tsModuleFixturePath = path.join(
|
||||
__dirname,
|
||||
'../../react-native-codegen/src/parsers/typescript/modules/__test_fixtures__/fixtures.js',
|
||||
);
|
||||
const tsModuleSnapshotPath = path.join(
|
||||
__dirname,
|
||||
'../../react-native-codegen/src/parsers/typescript/modules/__tests__/__snapshots__/typescript-module-parser-snapshot-test.js.snap',
|
||||
);
|
||||
const snapshotOutputPath = path.join(__dirname, '../__generated__');
|
||||
|
||||
function genereateSnapshotTestCases(name, fixturePath, snapshotPath, outputPath) {
|
||||
const fixtures = require(fixturePath);
|
||||
const snapshots = require(snapshotPath);
|
||||
for (const key of Object.keys(fixtures)) {
|
||||
const snapshotName = `RN Codegen TypeScript Parser can generate fixture ${key} 1`;
|
||||
const snapshotString = snapshots[snapshotName];
|
||||
const snapshot = snapshotString.substring(2, snapshotString.length - 2);
|
||||
const tsSourceCode = `
|
||||
function genereateSnapshotTestCases(
|
||||
name,
|
||||
fixturePath,
|
||||
snapshotPath,
|
||||
outputPath,
|
||||
) {
|
||||
const fixtures = require(fixturePath);
|
||||
const snapshots = require(snapshotPath);
|
||||
for (const key of Object.keys(fixtures)) {
|
||||
const snapshotName = `RN Codegen TypeScript Parser can generate fixture ${key} 1`;
|
||||
const snapshotString = snapshots[snapshotName];
|
||||
const snapshot = snapshotString.substring(2, snapshotString.length - 2);
|
||||
const tsSourceCode = `
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
@@ -34,9 +54,21 @@ import type { SchemaType } from '@react-native/codegen/lib/CodegenSchema';
|
||||
const snapshot : SchemaType = ${snapshot};
|
||||
export default snapshot;
|
||||
`;
|
||||
fs.writeFileSync(path.join(outputPath, `${name}_${key}.ts`), tsSourceCode, { encoding: 'utf-8' });
|
||||
}
|
||||
fs.writeFileSync(path.join(outputPath, `${name}_${key}.ts`), tsSourceCode, {
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
genereateSnapshotTestCases('component', tsComponentFixturePath, tsComponentSnapshotPath, snapshotOutputPath);
|
||||
genereateSnapshotTestCases('module', tsModuleFixturePath, tsModuleSnapshotPath, snapshotOutputPath);
|
||||
genereateSnapshotTestCases(
|
||||
'component',
|
||||
tsComponentFixturePath,
|
||||
tsComponentSnapshotPath,
|
||||
snapshotOutputPath,
|
||||
);
|
||||
genereateSnapshotTestCases(
|
||||
'module',
|
||||
tsModuleFixturePath,
|
||||
tsModuleSnapshotPath,
|
||||
snapshotOutputPath,
|
||||
);
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
dependency: {
|
||||
platforms: {
|
||||
android: {
|
||||
'cmakeListsPath': '../android/src/main/jni/CMakeLists.txt',
|
||||
cmakeListsPath: '../android/src/main/jni/CMakeLists.txt',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
+9
-2
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -26,7 +28,9 @@ const fs = require('fs');
|
||||
const buildGradleKtsPath = 'android/build.gradle.kts';
|
||||
const libsVersionsTomlPath = '../react-native/gradle/libs.versions.toml';
|
||||
|
||||
console.log(`Updating ${buildGradleKtsPath} with versions from ${libsVersionsTomlPath}...`);
|
||||
console.log(
|
||||
`Updating ${buildGradleKtsPath} with versions from ${libsVersionsTomlPath}...`,
|
||||
);
|
||||
|
||||
let gradleContent = fs.readFileSync(buildGradleKtsPath, 'utf8');
|
||||
const tomlContent = fs.readFileSync(libsVersionsTomlPath, 'utf8');
|
||||
@@ -39,7 +43,10 @@ gradleContent = gradleContent
|
||||
.replace('libs.versions.compileSdk.get().toInt()', compileSdk)
|
||||
.replace('libs.versions.minSdk.get().toInt()', minSdk)
|
||||
.replace('libs.versions.buildTools.get()', `"${buildTools}"`)
|
||||
.replace('project(":packages:react-native:ReactAndroid")', '"com.facebook.react:react-android"');
|
||||
.replace(
|
||||
'project(":packages:react-native:ReactAndroid")',
|
||||
'"com.facebook.react:react-android"',
|
||||
);
|
||||
|
||||
fs.writeFileSync(buildGradleKtsPath, gradleContent);
|
||||
|
||||
|
||||
@@ -3,8 +3,15 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
presets: [['module:@react-native/babel-preset', {disableStaticViewConfigsCodegen: false}]],
|
||||
presets: [
|
||||
[
|
||||
'module:@react-native/babel-preset',
|
||||
{disableStaticViewConfigsCodegen: false},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
||||
@@ -3,13 +3,15 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
module.exports = {
|
||||
dependency: {
|
||||
platforms: {
|
||||
android: {
|
||||
'cmakeListsPath': '../android/src/main/jni/CMakeLists.txt',
|
||||
cmakeListsPath: '../android/src/main/jni/CMakeLists.txt',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {create} from '../../../jest/renderer';
|
||||
@@ -14,46 +16,84 @@ describe('<Button />', () => {
|
||||
expect(await create(<Button title="Test Button" />)).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should be disabled and it should set accessibilityState to disabled when disabled={true}', async() => {
|
||||
it('should be disabled and it should set accessibilityState to disabled when disabled={true}', async () => {
|
||||
expect(
|
||||
await create(<Button title="Test Button" disabled={true} />)
|
||||
await create(<Button title="Test Button" disabled={true} />),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should be disabled when disabled={true} and accessibilityState={{disabled: true}}', async() => {
|
||||
it('should be disabled when disabled={true} and accessibilityState={{disabled: true}}', async () => {
|
||||
expect(
|
||||
await create(<Button title="Test Button" disabled={true} accessibilityState={{disabled: true}} />)
|
||||
await create(
|
||||
<Button
|
||||
title="Test Button"
|
||||
disabled={true}
|
||||
accessibilityState={{disabled: true}}
|
||||
/>,
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should be disabled when disabled is empty and accessibilityState={{disabled: true}}',async () => {
|
||||
it('should be disabled when disabled is empty and accessibilityState={{disabled: true}}', async () => {
|
||||
expect(
|
||||
await create(<Button title="Test Button" accessibilityState={{disabled: true}} />)
|
||||
await create(
|
||||
<Button title="Test Button" accessibilityState={{disabled: true}} />,
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should overwrite accessibilityState with value of disabled prop', async() => {
|
||||
expect(await create(<Button title="Test Button" disabled={true} accessibilityState={{disabled: false}} />)
|
||||
it('should overwrite accessibilityState with value of disabled prop', async () => {
|
||||
expect(
|
||||
await create(
|
||||
<Button
|
||||
title="Test Button"
|
||||
disabled={true}
|
||||
accessibilityState={{disabled: false}}
|
||||
/>,
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should not be disabled when disabled={false} and accessibilityState={{disabled: true}}', async() => {
|
||||
expect(await create(<Button title="Test Button" disabled={false} accessibilityState={{disabled: true}} />)
|
||||
it('should not be disabled when disabled={false} and accessibilityState={{disabled: true}}', async () => {
|
||||
expect(
|
||||
await create(
|
||||
<Button
|
||||
title="Test Button"
|
||||
disabled={false}
|
||||
accessibilityState={{disabled: true}}
|
||||
/>,
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should not be disabled when disabled={false} and accessibilityState={{disabled: false}}', async() => {
|
||||
expect(await create( <Button title="Test Button" disabled={false} accessibilityState={{disabled: false}} />)
|
||||
it('should not be disabled when disabled={false} and accessibilityState={{disabled: false}}', async () => {
|
||||
expect(
|
||||
await create(
|
||||
<Button
|
||||
title="Test Button"
|
||||
disabled={false}
|
||||
accessibilityState={{disabled: false}}
|
||||
/>,
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no-hide-descendants}', async() => {
|
||||
expect(await create( <Button title="Test Button" importantForAccessibility={'no-hide-descendants'} />)
|
||||
it('should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no-hide-descendants}', async () => {
|
||||
expect(
|
||||
await create(
|
||||
<Button
|
||||
title="Test Button"
|
||||
importantForAccessibility={'no-hide-descendants'}
|
||||
/>,
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no}', async() => {
|
||||
expect( await create( <Button title="Test Button" importantForAccessibility={'no'} />)
|
||||
it('should be set importantForAccessibility={no-hide-descendants} when importantForAccessibility={no}', async () => {
|
||||
expect(
|
||||
await create(
|
||||
<Button title="Test Button" importantForAccessibility={'no'} />,
|
||||
),
|
||||
).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @noformat
|
||||
* @generated by scripts/releases/set-version.js
|
||||
*/
|
||||
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ export default function (definitions: FeatureFlagDefinitions): string {
|
||||
*
|
||||
* ${signedsource.getSigningToken()}
|
||||
* @flow strict
|
||||
* @noformat
|
||||
*/
|
||||
|
||||
${DO_NOT_MODIFY_COMMENT}
|
||||
|
||||
+1
@@ -22,6 +22,7 @@ export default function (definitions: FeatureFlagDefinitions): string {
|
||||
*
|
||||
* ${signedsource.getSigningToken()}
|
||||
* @flow strict
|
||||
* @noformat
|
||||
*/
|
||||
|
||||
${DO_NOT_MODIFY_COMMENT}
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<2dc9ec2ea173f10586a67940720f1d37>>
|
||||
* @generated SignedSource<<29691b2062c240377834a01ced24c71c>>
|
||||
* @flow strict
|
||||
* @noformat
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
+2
-1
@@ -4,8 +4,9 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @generated SignedSource<<a7ffa9ddffa2dac8da58de63940981fb>>
|
||||
* @generated SignedSource<<59ebee6019b99a8c6a29dfc1eb036194>>
|
||||
* @flow strict
|
||||
* @noformat
|
||||
*/
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -21,54 +23,78 @@ import {
|
||||
} from 'react-native';
|
||||
|
||||
export function ScrollViewIndicatorInsetsExample() {
|
||||
const [automaticallyAdjustsScrollIndicatorInsets, setAutomaticallyAdjustsScrollIndicatorInsets] = useState(true);
|
||||
const [
|
||||
automaticallyAdjustsScrollIndicatorInsets,
|
||||
setAutomaticallyAdjustsScrollIndicatorInsets,
|
||||
] = useState(true);
|
||||
const [modalVisible, setModalVisible] = useState(false);
|
||||
const { height, width } = useWindowDimensions();
|
||||
const {height, width} = useWindowDimensions();
|
||||
|
||||
return (
|
||||
<View>
|
||||
<Modal
|
||||
animationType="slide"
|
||||
visible={modalVisible}
|
||||
onRequestClose={() => setModalVisible(false)}
|
||||
presentationStyle="fullScreen"
|
||||
statusBarTranslucent={false}
|
||||
supportedOrientations={['portrait', 'landscape']}>
|
||||
<View style={styles.modal}>
|
||||
<ScrollView
|
||||
contentContainerStyle={[
|
||||
styles.scrollViewContent,
|
||||
{
|
||||
height: (height * 1.2),
|
||||
width: (width * 1.2),
|
||||
},
|
||||
]}
|
||||
automaticallyAdjustsScrollIndicatorInsets={automaticallyAdjustsScrollIndicatorInsets}
|
||||
style={styles.scrollView}>
|
||||
<View style={styles.description}>
|
||||
<Text>When <Text style={styles.code}>automaticallyAdjustsScrollIndicatorInsets</Text> is true, the scrollbar is inset to the status bar. When false, it reaches the edge of the modal.</Text>
|
||||
<Text>Check out the UIScrollView docs to learn more about <Text style={styles.code}>automaticallyAdjustsScrollIndicatorInsets</Text></Text>
|
||||
</View>
|
||||
<View style={styles.toggle}>
|
||||
<Text><Text style={styles.code}>automaticallyAdjustsScrollIndicatorInsets</Text> is {automaticallyAdjustsScrollIndicatorInsets + ''}</Text>
|
||||
return (
|
||||
<View>
|
||||
<Modal
|
||||
animationType="slide"
|
||||
visible={modalVisible}
|
||||
onRequestClose={() => setModalVisible(false)}
|
||||
presentationStyle="fullScreen"
|
||||
statusBarTranslucent={false}
|
||||
supportedOrientations={['portrait', 'landscape']}>
|
||||
<View style={styles.modal}>
|
||||
<ScrollView
|
||||
contentContainerStyle={[
|
||||
styles.scrollViewContent,
|
||||
{
|
||||
height: height * 1.2,
|
||||
width: width * 1.2,
|
||||
},
|
||||
]}
|
||||
automaticallyAdjustsScrollIndicatorInsets={
|
||||
automaticallyAdjustsScrollIndicatorInsets
|
||||
}
|
||||
style={styles.scrollView}>
|
||||
<View style={styles.description}>
|
||||
<Text>
|
||||
When{' '}
|
||||
<Text style={styles.code}>
|
||||
automaticallyAdjustsScrollIndicatorInsets
|
||||
</Text>{' '}
|
||||
is true, the scrollbar is inset to the status bar. When false,
|
||||
it reaches the edge of the modal.
|
||||
</Text>
|
||||
<Text>
|
||||
Check out the UIScrollView docs to learn more about{' '}
|
||||
<Text style={styles.code}>
|
||||
automaticallyAdjustsScrollIndicatorInsets
|
||||
</Text>
|
||||
</Text>
|
||||
</View>
|
||||
<View style={styles.toggle}>
|
||||
<Text>
|
||||
<Text style={styles.code}>
|
||||
automaticallyAdjustsScrollIndicatorInsets
|
||||
</Text>{' '}
|
||||
is {automaticallyAdjustsScrollIndicatorInsets + ''}
|
||||
</Text>
|
||||
<Switch
|
||||
onValueChange={v => setAutomaticallyAdjustsScrollIndicatorInsets(v)}
|
||||
onValueChange={v =>
|
||||
setAutomaticallyAdjustsScrollIndicatorInsets(v)
|
||||
}
|
||||
value={automaticallyAdjustsScrollIndicatorInsets}
|
||||
style={styles.switch}/>
|
||||
</View>
|
||||
<Button
|
||||
onPress={() => setModalVisible(false)}
|
||||
title="Close"/>
|
||||
</ScrollView>
|
||||
</View>
|
||||
</Modal>
|
||||
<Text />
|
||||
<Button
|
||||
onPress={() => setModalVisible(true)}
|
||||
title="Present Fullscreen Modal with ScrollView"/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
style={styles.switch}
|
||||
/>
|
||||
</View>
|
||||
<Button onPress={() => setModalVisible(false)} title="Close" />
|
||||
</ScrollView>
|
||||
</View>
|
||||
</Modal>
|
||||
<Text />
|
||||
<Button
|
||||
onPress={() => setModalVisible(true)}
|
||||
title="Present Fullscreen Modal with ScrollView"
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
modal: {
|
||||
@@ -87,7 +113,7 @@ const styles = StyleSheet.create({
|
||||
switch: {
|
||||
marginBottom: 40,
|
||||
},
|
||||
toggle:{
|
||||
toggle: {
|
||||
margin: 20,
|
||||
alignItems: 'center',
|
||||
},
|
||||
@@ -107,6 +133,6 @@ exports.description =
|
||||
exports.examples = [
|
||||
{
|
||||
title: '<ScrollView> automaticallyAdjustsScrollIndicatorInsets Example',
|
||||
render: (): React.Node => <ScrollViewIndicatorInsetsExample/>,
|
||||
render: (): React.Node => <ScrollViewIndicatorInsetsExample />,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@@ -20,7 +22,10 @@ import {
|
||||
} from 'react-native';
|
||||
|
||||
export function ScrollViewKeyboardInsetsExample() {
|
||||
const [automaticallyAdjustKeyboardInsets, setAutomaticallyAdjustKeyboardInsets] = useState(true);
|
||||
const [
|
||||
automaticallyAdjustKeyboardInsets,
|
||||
setAutomaticallyAdjustKeyboardInsets,
|
||||
] = useState(true);
|
||||
const [flatList, setFlatList] = useState(false);
|
||||
const [inverted, setInverted] = useState(false);
|
||||
const [heightRestricted, setHeightRestricted] = useState(false);
|
||||
@@ -33,13 +38,15 @@ export function ScrollViewKeyboardInsetsExample() {
|
||||
};
|
||||
|
||||
const data = [...Array(20).keys()];
|
||||
const renderItem = ({ item, index }) => {
|
||||
const largeInput = (index % 5) === 4;
|
||||
const renderItem = ({item, index}) => {
|
||||
const largeInput = index % 5 === 4;
|
||||
return (
|
||||
<View key={item} style={styles.textInputRow}>
|
||||
<TextInput placeholder={item.toString()}
|
||||
multiline={largeInput}
|
||||
style={[styles.textInput, largeInput && styles.textInputLarger]}/>
|
||||
<TextInput
|
||||
placeholder={item.toString()}
|
||||
multiline={largeInput}
|
||||
style={[styles.textInput, largeInput && styles.textInputLarger]}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
};
|
||||
@@ -47,52 +54,67 @@ export function ScrollViewKeyboardInsetsExample() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<View style={styles.controlRow}>
|
||||
<Text><Text style={styles.code}>automaticallyAdjustKeyboardInsets</Text> is {automaticallyAdjustKeyboardInsets + ''}</Text>
|
||||
<Text>
|
||||
<Text style={styles.code}>automaticallyAdjustKeyboardInsets</Text> is{' '}
|
||||
{automaticallyAdjustKeyboardInsets + ''}
|
||||
</Text>
|
||||
<Switch
|
||||
onValueChange={v => setAutomaticallyAdjustKeyboardInsets(v)}
|
||||
value={automaticallyAdjustKeyboardInsets}
|
||||
style={styles.controlSwitch}/>
|
||||
style={styles.controlSwitch}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.controlRow}>
|
||||
<Text><Text style={styles.code}>FlatList</Text> is {flatList + ''}</Text>
|
||||
<Text>
|
||||
<Text style={styles.code}>FlatList</Text> is {flatList + ''}
|
||||
</Text>
|
||||
<Switch
|
||||
onValueChange={v => setFlatList(v)}
|
||||
value={flatList}
|
||||
style={styles.controlSwitch}/>
|
||||
style={styles.controlSwitch}
|
||||
/>
|
||||
</View>
|
||||
{flatList && (
|
||||
<View style={styles.controlRow}>
|
||||
<Text><Text style={styles.code}>inverted</Text> is {inverted + ''}</Text>
|
||||
<Text>
|
||||
<Text style={styles.code}>inverted</Text> is {inverted + ''}
|
||||
</Text>
|
||||
<Switch
|
||||
onValueChange={v => setInverted(v)}
|
||||
value={inverted}
|
||||
style={styles.controlSwitch}/>
|
||||
style={styles.controlSwitch}
|
||||
/>
|
||||
</View>
|
||||
)}
|
||||
<View style={styles.controlRow}>
|
||||
<Text><Text style={styles.code}>HeightRestricted</Text> is {heightRestricted + ''}</Text>
|
||||
<Text>
|
||||
<Text style={styles.code}>HeightRestricted</Text> is{' '}
|
||||
{heightRestricted + ''}
|
||||
</Text>
|
||||
<Switch
|
||||
onValueChange={v => setHeightRestricted(v)}
|
||||
value={heightRestricted}
|
||||
style={styles.controlSwitch}/>
|
||||
style={styles.controlSwitch}
|
||||
/>
|
||||
</View>
|
||||
<View style={styles.controlRow}>
|
||||
<TextInput placeholder={'Text input outside scroll view'} style={styles.controlTextInput} />
|
||||
<TextInput
|
||||
placeholder={'Text input outside scroll view'}
|
||||
style={styles.controlTextInput}
|
||||
/>
|
||||
</View>
|
||||
{flatList
|
||||
? (
|
||||
<FlatList
|
||||
{...scrollViewProps}
|
||||
inverted={inverted}
|
||||
data={data}
|
||||
renderItem={renderItem}/>
|
||||
)
|
||||
: (
|
||||
<ScrollView {...scrollViewProps}>
|
||||
{data.map((item, index) => renderItem({ item, index }))}
|
||||
</ScrollView>
|
||||
)
|
||||
}
|
||||
{flatList ? (
|
||||
<FlatList
|
||||
{...scrollViewProps}
|
||||
inverted={inverted}
|
||||
data={data}
|
||||
renderItem={renderItem}
|
||||
/>
|
||||
) : (
|
||||
<ScrollView {...scrollViewProps}>
|
||||
{data.map((item, index) => renderItem({item, index}))}
|
||||
</ScrollView>
|
||||
)}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
@@ -137,8 +159,7 @@ const styles = StyleSheet.create({
|
||||
borderBottomWidth: 1,
|
||||
borderBottomColor: '#ccc',
|
||||
},
|
||||
controlSwitch: {
|
||||
},
|
||||
controlSwitch: {},
|
||||
controlTextInput: {
|
||||
flex: 1,
|
||||
paddingVertical: 10,
|
||||
@@ -160,6 +181,6 @@ exports.description =
|
||||
exports.examples = [
|
||||
{
|
||||
title: '<ScrollView> automaticallyAdjustKeyboardInsets Example',
|
||||
render: (): React.Node => <ScrollViewKeyboardInsetsExample/>,
|
||||
render: (): React.Node => <ScrollViewKeyboardInsetsExample />,
|
||||
},
|
||||
];
|
||||
|
||||
@@ -8,6 +8,7 @@ exports[`updateReactNativeArtifacts should set nightly version: packages/react-n
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @noformat
|
||||
* << GENERATED >>
|
||||
*/
|
||||
|
||||
@@ -135,6 +136,7 @@ exports[`updateReactNativeArtifacts should set release version: packages/react-n
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @noformat
|
||||
* << GENERATED >>
|
||||
*/
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ module.exports = ({version} /*: {version: Version} */) /*: string */ => `/**
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow strict
|
||||
* @noformat
|
||||
* ${'@'}generated by scripts/releases/set-version.js
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user