Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rtl transition without header on iOS #831

Merged
merged 1 commit into from Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions TestsExample/App.js
Expand Up @@ -29,6 +29,7 @@ import Test748 from './src/Test748';
import Test750 from './src/Test750';
import Test765 from './src/Test765';
import Test780 from './src/Test780';
import Test831 from './src/Test831';

enableScreens();

Expand Down
41 changes: 41 additions & 0 deletions TestsExample/src/Test831.tsx
@@ -0,0 +1,41 @@
import * as React from 'react';
import {Button, View} from 'react-native';
import {NavigationContainer, ParamListBase} from '@react-navigation/native';
import {createNativeStackNavigator, NativeStackNavigationProp} from 'react-native-screens/native-stack';

type Props = {
navigation: NativeStackNavigationProp<ParamListBase>;
}

const Stack = createNativeStackNavigator();

export default function App(): JSX.Element {
return (
<NavigationContainer>
<Stack.Navigator screenOptions={{direction: 'rtl', headerShown: false}}>
<Stack.Screen name="First" component={First} />
<Stack.Screen
name="Second"
component={Second}
/>
</Stack.Navigator>
</NavigationContainer>
);
}

function First({navigation}: Props) {
return (
<View style={{flex: 1, justifyContent: 'center'}} >
<Button title="Tap me for second screen" onPress={() => navigation.navigate('Second')} />
</View>
);
}

function Second({navigation}: Props) {
return (
<View style={{flex: 1, justifyContent: 'center'}} >
<Button title="Tap me for first screen" onPress={() => navigation.navigate('First')} />
</View>
);
}

8 changes: 4 additions & 4 deletions ios/RNSScreenStackHeaderConfig.m
Expand Up @@ -388,15 +388,15 @@ + (void)updateViewController:(UIViewController *)vc withConfig:(RNSScreenStackHe
}
#endif

if (shouldHide) {
return;
}

if (config.direction == UISemanticContentAttributeForceLeftToRight || config.direction == UISemanticContentAttributeForceRightToLeft) {
navctr.view.semanticContentAttribute = config.direction;
navctr.navigationBar.semanticContentAttribute = config.direction;
}

if (shouldHide) {
return;
}

navitem.title = config.title;
#if !TARGET_OS_TV
if (config.backTitle != nil || config.backTitleFontFamily || config.backTitleFontSize) {
Expand Down