Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/rn-tester/js/RNTesterAppShared.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ const RNTesterApp = ({
return null;
}

const isIOS = Platform.OS === 'ios';
const activeModule =
// $FlowFixMe[invalid-computed-prop]
activeModuleKey != null ? RNTesterList.Modules[activeModuleKey] : null;
Expand All @@ -289,7 +290,7 @@ const RNTesterApp = ({

const BackButtonComponent: ?BackButton = customBackButton
? customBackButton
: Platform.OS === 'ios'
: isIOS
? ({onBack}) => (
<Button title="Back" onPress={onBack} color={theme.LinkColor} />
)
Expand Down Expand Up @@ -322,17 +323,19 @@ const RNTesterApp = ({
module={activeModule}
example={activeModuleExample}
onExampleCardPress={handleModuleExampleCardPress}
bottomInset={isIOS ? contentInsets.bottom : undefined}
/>
) : (
<RNTesterModuleList
sections={activeExampleList}
handleModuleCardPress={handleModuleCardPress}
bottomInset={isIOS ? contentInsets.bottom : 0}
/>
)}
</View>
);

if (Platform.OS === 'ios') {
if (isIOS) {
return (
<RNTesterThemeContext.Provider value={theme}>
<RNTesterTabsIOS
Expand All @@ -352,7 +355,6 @@ const RNTesterApp = ({
backgroundColor: theme.GroupedBackgroundColor,
paddingLeft: contentInsets.left,
paddingRight: contentInsets.right,
paddingBottom: contentInsets.bottom,
})}>
<View
style={{
Expand All @@ -371,7 +373,7 @@ const RNTesterApp = ({

return (
<RNTesterThemeContext.Provider value={theme}>
{Platform.OS === 'android' ? <StatusBar barStyle="dark-content" /> : null}
<StatusBar barStyle="dark-content" />
{titleBar}
{content}
{!shouldHideChrome && (
Expand Down
9 changes: 9 additions & 0 deletions packages/rn-tester/js/components/RNTesterExampleFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Props<T> = {
disableSearch?: boolean,
testID?: string,
hideFilterPills?: boolean,
bottomInset?: number,
page: 'examples_page' | 'components_page',
sections: ReadonlyArray<SectionData<T>>,
...
Expand Down Expand Up @@ -91,6 +92,14 @@ class RNTesterExampleFilter<T> extends React.Component<Props<T>, State> {
if (this.props.page === 'examples_page') {
return (
<ScrollView
contentContainerStyle={
this.props.bottomInset != null
? {paddingBottom: this.props.bottomInset}
: undefined
}
automaticallyAdjustContentInsets={
this.props.bottomInset != null ? false : undefined
}
keyboardShouldPersistTaps="handled"
keyboardDismissMode="interactive">
{this.props.render({filteredSections})}
Expand Down
21 changes: 18 additions & 3 deletions packages/rn-tester/js/components/RNTesterModuleContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,15 @@ type Props = {
module: RNTesterModule,
example?: ?RNTesterModuleExample,
onExampleCardPress?: ?(exampleName: string) => unknown,
bottomInset?: number,
};

function getExampleTitle(title: $FlowFixMe, platform: $FlowFixMe) {
return platform != null ? `${title} (${platform} only)` : title;
}

export default function RNTesterModuleContainer(props: Props): React.Node {
const {module, example, onExampleCardPress} = props;
const {module, example, onExampleCardPress, bottomInset} = props;
const theme = useContext(RNTesterThemeContext);
const renderExample = (e: $FlowFixMe, i: $FlowFixMe) => {
// Filter platform-specific es
Expand Down Expand Up @@ -82,11 +83,24 @@ export default function RNTesterModuleContainer(props: Props): React.Node {
return singleModule != null ? (
<>
{singleModule.scrollable === true ? (
<ScrollView style={styles.examplesContainer} testID="example-container">
<ScrollView
style={styles.examplesContainer}
contentContainerStyle={
bottomInset != null ? {paddingBottom: bottomInset} : undefined
}
automaticallyAdjustContentInsets={
bottomInset != null ? false : undefined
}
testID="example-container">
<singleModule.render />
</ScrollView>
) : (
<View style={styles.examplesContainer} testID="example-container">
<View
style={[
styles.examplesContainer,
bottomInset != null && {marginBottom: bottomInset},
]}
testID="example-container">
<singleModule.render />
</View>
)}
Expand All @@ -99,6 +113,7 @@ export default function RNTesterModuleContainer(props: Props): React.Node {
testID="example_search"
page="examples_page"
hideFilterPills={true}
bottomInset={bottomInset}
sections={sections}
filter={filter}
render={({filteredSections}) =>
Expand Down
6 changes: 4 additions & 2 deletions packages/rn-tester/js/components/RNTesterModuleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const renderSectionHeader = ({section}: {section: any, ...}) => (
);

const RNTesterModuleList: React.ComponentType<any> = memo(
({sections, handleModuleCardPress}: any) => {
({sections, handleModuleCardPress, bottomInset = 0}: any) => {
const filter = ({example, filterRegex, category}: any) =>
filterRegex.test(example.module.title) &&
(!category || example.category === category);
Expand Down Expand Up @@ -102,7 +102,9 @@ const RNTesterModuleList: React.ComponentType<any> = memo(
keyboardDismissMode="on-drag"
renderSectionHeader={renderSectionHeader}
// eslint-disable-next-line react/no-unstable-nested-components
ListFooterComponent={() => <View style={{height: 80}} />}
ListFooterComponent={() => (
<View style={{height: Math.max(80, bottomInset)}} />
)}
/>
)}
/>
Expand Down
Loading